Closed Eduardo06sp closed 1 year ago
Looks good to me. I see what you are saying about using sign_in
versus making the post request. I think for this instance we can keep as is. I don't suspect the password field is something that would need to change in future. If it does become a problem, we can take option two as you stated.
Summary of changes:
test/fixtures/users.yml
It was just missing a newline at the end of the file!test/integration/user_account_test.rb
Testing the correct response after signing in and out.Potential cause for concern:
test/integration/user_account_test.rb:9
You may notice that the test for signing in uses the hard-coded parameterpassword: 'password'
. It needs to be hard-coded because the fixture (just like the db) stores theencrypted_password
. However, Rails expects a plaintext password as the parameter. You cannot pass inusers(:one).encrypted_password
, as it will receive the hash instead and fail to sign in.The cleanest implementation involves replacing the entire
post
method with this single line:However, this would not have the added benefit of testing the
/sign_in
request. Please let me know if you prefer that I use thesign_in
helper method instead.Closes issue:
87