黄瓜BDD与水豚和设计整合

时间:2011-06-28 11:11:15

标签: devise cucumber rake capybara versions

作为my previous question on 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上)。

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

  • ruby​​ 1.8.7
  • rails 3.0.3
  • capybara 1.0.0
  • 黄瓜1.0.0
  • 设计1.2.rc
  • rake 0.9.2

0 个答案:

没有答案