Reputation: 4610
i'm trying to test user sign up. using rails+devise 1.1.rc2 I have this test:
Given I am on the landing page
When I go to the registration page
And I fill in "Firstname" with "F"
And I fill in "Lastname" with "L"
And I fill in "Country" with "C"
And I fill in "State" with "S"
And I fill in "City" with "C"
And I fill in "Email" with "[email protected]"
And I fill in "Password" with "password"
And I fill in "Password Confirmation" with "password"
And I press "Register"
Then I should see "You have registered successfully. If enabled, a confirmation was sent your e-mail."
This is the error snippet:
expected the following element's content to include "You have registered successfully. If enabled, a confirmation was sent your e-mail.":
You are being redirected. (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:145:in `/^(?:|I )should see "([^"]*)"$/'
features/registration.feature:42:in `Then I should see "You have registered successfully. If enabled, a confirmation was sent your e-mail."
I think it's got something to do with a redirect, not sure how to fix this? But in my app_controller.rb i have this so the user is taken to the dashboard page...
def after_sign_in_path_for(resource_or_scope)
"/dashboard"
end
its just the test thats failing, the actual registration functionality is fine.
Upvotes: 0
Views: 1134
Reputation: 59
This has been answered in another stack overflow post. Basically the flash message does not persist through redirect_to, but render :action => xxxx will make it work.
authlogic flash[:notice] does not show up in cucumber webrat step
Upvotes: 1
Reputation: 107728
I would recommend upgrading Devise to be the latest (1.2, at current writing) release.
Then I would debug what's happening here by putting Then show me the page
above the step that's failing. I think your flash message is wrong.
Upvotes: 0