You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me a long time to figure out what was happening. (And then to write this comment.) It's crunch time now that I'm doing the "putting-it-all-together" lab, and I question the learning value for the time required to understand.
This statement leads the reader to believe that all tests in "spec/requests/users_spec.rb" should pass before moving on:
Make sure the signup and auto-login features work as intended before moving forward. You can test the UsersController requests with RSpec:
rspec spec/requests/users_spec.rb
Technically, the following error message I get from running "rspec spec/requests/users_spec.rb"
Users GET /me returns the first user when the first user is logged in
Failure/Error: post "/login", params: { username: user1.username, password: user1.password }
is flagging "/login" as the problem, which is not associated with either "users#create" or "users#show". But that fact is shrouded with the "don't mess with our tests" authority statement from rspec regarding "1) Users GET /me returns the first user when the first user is logged in". That is, as students we are trusting that "UsersController" tests will only be testing stuff in "users_controller.rb", but the test for "GET /me" slips in a test of "/login", a "SessionsController" method routing to "sessions#create" that we have not yet written per:
post "/login", params: { username: user1.username, password: user1.password }
get "/me"
We see this second test failing for the same reason: it "returns the second user when the second user is logged in"
The warning to make things work before moving forward traps the student in a murky place. It wastes precious time until we either give up heeding the warning or else notice that the test for get "/me", to: "users#show"
is failing because it's also testing post "/login", to: "sessions#create"
Additional Context
No response
Suggested Changes
It's understandable that we must log in to test whether a session persists. Maybe this combo test can go in a file that advertises that it's testing two different controllers, e.g. "spec/requests/users_sessions_spec.rb"
And then use different wording in the lab regarding how to test GET "/me" before moving on.
Something.
The text was updated successfully, but these errors were encountered:
Canvas Link
https://learning.flatironschool.com/courses/5188/assignments/181033?module_item_id=399412
Concern
It took me a long time to figure out what was happening. (And then to write this comment.) It's crunch time now that I'm doing the "putting-it-all-together" lab, and I question the learning value for the time required to understand.
This statement leads the reader to believe that all tests in "spec/requests/users_spec.rb" should pass before moving on:
Technically, the following error message I get from running "rspec spec/requests/users_spec.rb"
Failure/Error: post "/login", params: { username: user1.username, password: user1.password }
is flagging "/login" as the problem, which is not associated with either "users#create" or "users#show". But that fact is shrouded with the "don't mess with our tests" authority statement from rspec regarding "1) Users GET /me returns the first user when the first user is logged in". That is, as students we are trusting that "UsersController" tests will only be testing stuff in "users_controller.rb", but the test for "GET /me" slips in a test of "/login", a "SessionsController" method routing to "sessions#create" that we have not yet written per:
We see this second test failing for the same reason:
it "returns the second user when the second user is logged in"
The warning to make things work before moving forward traps the student in a murky place. It wastes precious time until we either give up heeding the warning or else notice that the test for
get "/me", to: "users#show"
is failing because it's also testing
post "/login", to: "sessions#create"
Additional Context
No response
Suggested Changes
It's understandable that we must log in to test whether a session persists. Maybe this combo test can go in a file that advertises that it's testing two different controllers, e.g. "spec/requests/users_sessions_spec.rb"
And then use different wording in the lab regarding how to test
GET "/me"
before moving on.Something.
The text was updated successfully, but these errors were encountered: