In the third lesson instead of resource :session if we write resources :session then the test doesn’t pass anyway.
Here in this code if we write resources session
then the following code…
Rails.application.routes.draw do
root to: "todos#index"
resources :todos, only: [:index,:new,:create]
resource :session, only: [:new]
end
… continuously show the following error.
rspec spec/features/user_creates_todo_spec.rb
F
Failures:
1) User creates todo successfully
Failure/Error: sign_in
ActionController::RoutingError:
uninitialized constant SessionController
# ./spec/support/features/sign_in.rb:3:in `sign_in'
# ./spec/features/user_creates_todo_spec.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.02543 seconds (files took 1.77 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/features/user_creates_todo_spec.rb:4 # User creates todo successfully
Why is it looking for SessionController
instead of SessionsController
?
Rake routes shows the same routes for both resource
and resources
and even stack-overflow suggest that the only diffrence is that `resource means resources without index action.
I’m confused. Please help!