Repository navigation
Refactor user controller tests - #449
Merged
Merged
Conversation
begedin
requested changes
Nov 8, 2016
| assert user.last_name == "User" | ||
| assert user.website == "http://www.example.com" | ||
| assert user.biography == "Just a test user" | ||
| assert conn |> authenticate(user) |> put(path, params) |> json_response(200) |
Contributor
|
Tests seem to pass here. What's the reason for "help wanted". Anything I can help with? |
sbatson5
reviewed
Nov 8, 2016
| [user_1, user_2] = insert_pair(:user) | ||
|
|
||
| conn | ||
| |> request_index |
There was a problem hiding this comment.
I think the patter is not to indent here.
| |> json_response(200) | ||
|
|
||
| assert json["data"]["attributes"]["email"] == user.email | ||
| assert json["data"]["attributes"]["email"] == current_user.email |
There was a problem hiding this comment.
Do we need to assert that the email is serialized correctly? Does the json_response returning 200 cover us?
Contributor
There was a problem hiding this comment.
@sbatson5 I initially thought that we did need to test this here, but we do have a way of testing this at the level of the view test. In that test we do conn = Phoenix.ConnTest.build_conn |> assign(:current_user, auth_user) in order to check that the user only see their email when authorized.
We can remove that assertion from here then @mackenziehicks. Asserting 200 is sufficient.
mackenziehicks
force-pushed
the
443-refactor-user-controller-tests
branch
from
November 11, 2016 21:14
a2989a9 to
72a5974
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's in this PR?
Added helpers from api_case.ex to the tests for User Controller.
References
Fixes #443
Progress on: #413