I'm currently trying to configure integration / acceptance testing for a new rails 3 application with cucumber and capybara. (I originally planned to use webrat, but it doesn't seem to support rails 3, so I ended up with capybara)
I am trying to run a basic login test:
Feature: Login user In order to access the non-public parts of the site, as a user, I want to login to the site Scenario: login with valid credentials Given I am on the login page When I fill in "Email" with "bender@planetexpress.com" And I fill in "Password" with "pass" And I press "Login" Then I should be on the users home page And I should see "Login successful"
Now the problem is that the login form sends me to /user_session , which then redirects me to the /home users /home . Cucumber does not redirect, due to which the line Then I should be on the users home page fails.
How can I tell the cucumber / capybara to follow the redirect, so that I am on the right page after I click the button after the link?
There seems to be a follow_redirect! method follow_redirect! in the rack_test driver that I use, but it's closed, and I donโt know what to call this functionality.
early,
Simon
redirect ruby-on-rails cucumber capybara
Simon wallner
source share