Created
April 7, 2015 18:46
-
-
Save adanselm/3df936e68b5e01f91940 to your computer and use it in GitHub Desktop.
Example unit-test in elixir phoenix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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