kasugaijin / baja-pet-rescue

Kasugaijin's open-source Ruby on Rails production app that enables dog rescue organisation staff in Mexico to post dogs and receive applications for adoption from users in USA and Canada..
27 stars 9 forks source link

Test redirect after signing in or out #93

Closed Eduardo06sp closed 1 year ago

Eduardo06sp commented 1 year ago

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 parameter password: 'password'. It needs to be hard-coded because the fixture (just like the db) stores the encrypted_password. However, Rails expects a plaintext password as the parameter. You cannot pass in users(: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:

sign_in users(:one)

However, this would not have the added benefit of testing the /sign_in request. Please let me know if you prefer that I use the sign_in helper method instead.

Closes issue:

87

kasugaijin commented 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.