升级到Devise 1.2.1后,黄瓜功能失败

时间:2011-04-10 02:35:53

标签: ruby-on-rails

我在http://github.com/rails3book/ticketee处有一个应用程序,当使用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 "user@ticketee.com"
    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

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

我非常希望使用最新的Devise,正在阅读此应用程序正在设计的书的人也会这样做。

我试图弄清楚到目前为止出了什么问题但无济于事。如果您有任何想法,他们将非常感激。

1 个答案:

答案 0 :(得分:2)

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

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

但是,在确认设置重定向到具有该flash消息的根页面之前会发生什么。您的root被定义为需要在before_filter中登录的项目#index,因此您将再次重定向到登录页面,而是看到:

“在继续之前,您需要登录或注册。”