开发者

Cucumber BDD with capybara and devise integration

开发者 https://www.devze.com 2023-03-15 17:38 出处:网络
As a followup to my previous question on SO, I have followed the tutorial at https://github.com/RailsApps/rails3-devise-rspec-cucumber/wiki/Tutorial religiously to try pinpoint the origin of my test f

As a followup to my previous question on SO, I have followed the tutorial at https://github.com/RailsApps/rails3-devise-rspec-cucumber/wiki/Tutorial religiously to try pinpoint the origin of my test failures.

My basic scenario fails:

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

These are my steps:

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

The login fails even though my test user is correctly created. Using save_and_open_page shows that capybara fills the form as expected so it seems like this is a d开发者_C百科evise issue.

I am wondering whether there is an integration issue with the components since I am using a rails 3.0 setup (the tutorial is on 3.1).

My environment is using the following:

  • ruby 1.8.7
  • rails 3.0.3
  • capybara 1.0.0
  • cucumber 1.0.0
  • devise 1.2.rc
  • rake 0.9.2
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号