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 [email protected]?
  @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:

<div id="error_div" style="visibility: <%= @show_div ? 'visible' :
'hidden' %>">
<%= @error_note %>
</div>

-------------

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.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to