Ryan Bigg
Ryan Bigg

Reputation: 107728

Cucumber feature fails after upgrading to Devise 1.2.1

I've got an application at http://github.com/rails3book/ticketee which is currently failing when the features are run using bundle exec cucumber features/signing_up.feature.

  Scenario: Signing up
    Given I am on the homepage
    When I follow "Sign up"
    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 "Sign up"
    Then show me the page
    Then I should see "You have signed up successfully."
      Failed assertion, no message given. (MiniTest::Assertion)
      /Users/ryanbigg/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/minitest/unit.rb:85:in `assert'
      /Users/ryanbigg/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/test/unit/assertions.rb:19:in `assert'
      ./features/step_definitions/web_steps.rb:105:in `block (2 levels) in <top (required)>'
      ./features/step_definitions/web_steps.rb:13:in `with_scope'
      ./features/step_definitions/web_steps.rb:101:in `/^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/'
      features/signing_up.feature:14:in `Then I should see "You have signed up successfully."'

Failing Scenarios:
cucumber features/signing_up.feature:6 # Scenario: Signing up

This feature was not failing before I upgraded Devise from 1.1.8 to 1.2.1. It is now failing because it is redirecting the user to the sign in page as soon as they're redirected to the root path after successfully signing in.

I would very much like to use the latest Devise as people who are reading the book this app is being designed for will be doing that also.

I have attempted to figure out what is going wrong so far to no avail. If you have any ideas they would be most appreciated.

Upvotes: 1

Views: 947

Answers (1)

Jeff Rafter
Jeff Rafter

Reputation: 169

The problem is that the user is not signed in after signup because it is waiting on confirmation. If you remove confirmable from your User model then the feature will pass. Another solution is to expect the confirmation message in your feature:

"You have to confirm your account before continuing."

However, what happens is before confirmation devise redirects to the root page with that flash message. Your root is defined as projects#index which requires sign in in your before_filter, so you get redirected again back to the sign in page and instead see:

"You need to sign in or sign up before continuing."

Upvotes: 2

Related Questions