作为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上)。
我的环境正在使用以下内容: