2011-04-10 58 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中登錄的項目#索引,因此您會再次重定向回登錄頁面,而不會看到:

「您需要先登錄或註冊才能繼續。