Hi,
I have a cucumber scenario to verify what happens when an user account
is not active yet. In that situation it will display an error and keep
the user in the same login screen. The scenario includes:
…
And I press “Login”
Then I should be on the login page
And I should see “Your account has not been activated yet.”
…
In routes.rb I have:
map.login ‘/login’, :controller => ‘user_sessions’, :action => ‘new’
In paths.rb I have:
when /the login page/
login_path
In user_sessions_controller.rb I have:
if !@user.active?
@show_div = true
@error_note = “Your account has not been activated yet!”
@user_session = UserSession.new
render :action => :new
else
In new.html.erb a hidden div meant to show the errors:
My problem is that cucumber test fails with this:
And I press “Login”
Then I should be on the login page
expected: “/login”,
got: “/user_session” (using ==)
Which makes sense because paths.rb say one thing and render :action say
something else.
But I like to use the render :action so I can easily activate the error
message for the user.
What would be the best approach to solve this problem?
The thing works but not the cucumber test.
Thanks.