4

作为我之前关于 SO的问题的后续,我已经按照https://github.com/RailsApps/rails3-devise-rspec-cucumber/wiki/Tutorial上的教程虔诚地尝试查明我的测试失败的根源。

我的基本情况失败:

Feature: Sign in
  Scenario: User signs in successfully with email
    Given I am a new, authenticated user 
    When I go to the tour page
    Then I should be signed in

这些是我的步骤:

Given /^I have one\s+user "([^\"]*)" with password "([^\"]*)"$/ do |email, password|
  u = User.new(:email => email,
           :password => password,
           :password_confirmation => password)
  u.skip_confirmation!
  u.save!
end

Given /^I am a new, authenticated user$/ do
  email = 'user@test.com'
  password = 'please'

  Given %{I have one user "#{email}" with password "#{password}"}
  And %{I go to the sign in page}
  And %{I fill in "user_email" with "#{email}"}
  And %{I fill in "user_password" with "#{password}"}
  And %{I press "Log Me In"}
end

Then /^I should be signed in$/ do
  And %{I should see "Sign out"}
end

即使我的测试用户已正确创建,登录也会失败。使用 save_and_open_page 表明 capybara 按预期填写表单,因此这似乎是一个设计问题。

我想知道组件是否存在集成问题,因为我使用的是 rails 3.0 设置(本教程在 3.1 上)。

我的环境正在使用以下内容:

  • 红宝石 1.8.7
  • 导轨 3.0.3
  • 水豚 1.0.0
  • 黄瓜 1.0.0
  • 设计 1.2.rc
  • 耙子 0.9.2
4

0 回答 0