2011-04-10 39 views
1

我有一个http://github.com/rails3book/ticketee应用程序,当使用bundle exec cucumber features/signing_up.feature运行功能时,目前失败。升级到Devise 1.2.1后黄瓜功能失效

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 

此功能并没有失败之前,我把1.1.8升级到1.2.1。它现在失败了,因为只要成功登录后它们被重定向到根路径,它就会将用户重定向到登录页面。

我非常希望将最新的Devise用作人正在阅读这个应用程序正在设计的书也将做到这一点。

我试图弄清楚到目前为止什么问题都无济于事。如果你有任何想法,他们将不胜感激。

回答

2

问题是用户在注册后没有登录,因为它正在等待确认。如果您从用户模型中删除可确认,则该功能将会通过。另一种解决方案是预计功能中的确认消息:

“您必须在继续之前确认您的帐户。”

但是,发生的情况是在确认设计重定向到具有该Flash消息的根页面之前。您的根目录定义为需要在您的before_filter中登录的项目#索引,因此您会再次重定向回登录页面,而不会看到:

“您需要先登录或注册才能继续。