Cucumber BDD with capybara and devise integration

女生的网名这么多〃 提交于 2019-12-06 06:00:49

问题


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 devise 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

来源:https://stackoverflow.com/questions/6505498/cucumber-bdd-with-capybara-and-devise-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!