Skip to content

Instantly share code, notes, and snippets.

@adanselm
Created April 7, 2015 18:46
Show Gist options
  • Save adanselm/3df936e68b5e01f91940 to your computer and use it in GitHub Desktop.
Save adanselm/3df936e68b5e01f91940 to your computer and use it in GitHub Desktop.
Example unit-test in elixir phoenix
test "get /api/users returns a list of users" do
users_as_json =
%User{first_name: "Bob", last_name: "Dylan", email: "bob@aol.com"}
|> Repo.insert
|> List.wrap
|> Poison.encode!
response = conn(:get, "/api/users") |> send_request
assert response.status == 200
assert response.resp_body == users_as_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment