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 を使用すると、カピバラが期待どおりにフォームに入力されることが示されるため、これは工夫の問題のようです。

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