Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for path params #8

Open
coryodaniel opened this issue Sep 27, 2016 · 0 comments
Open

Support for path params #8

coryodaniel opened this issue Sep 27, 2016 · 0 comments

Comments

@coryodaniel
Copy link
Owner

It would be nice to have "path_params" that were a part of the request, that would be interpolated before the request was fired, instead of having to do it manually in the test.

Currently:

  test "[GET] /pets/{id} (200)" do
    pet = %Pet{name: "Chauncy", type: "cat"} |> Repo.insert!

    transaction = @swagger
      |> Apocryphal.Transaction.get("/pets/{id}", 200, @mime)

    path = Regex.replace(~r/{id}/, transaction.request.uri, "#{pet.id}")

    transaction
      |> put_in([:request, :uri], path)
      |> assert_schema
  end

Proposed:

  test "[GET] /pets/{id} (200)" do
    pet = %Pet{name: "Chauncy", type: "cat"} |> Repo.insert!

    @swagger
      |> Apocryphal.Transaction.get("/pets/{id}", 200, @mime)
      |> put_in([:request, :path_params], %{"id" => pet.id})
      |> assert_schema
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant