我正在尝试使用Cucumber测试登录功能.我的文件users_steps.rb包含
Given /^I am a user named "([^"]*)" with an email "([^"]*)" and password "([^"]*)"$/ do |name, email, password|
u = User.new(:name => name,
:email => email,
:password => password,
:password_confirmation => password)
u.skip_confirmation!
u.save!
end
When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
#Given %{I am not logged in}
When %{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 …Run Code Online (Sandbox Code Playgroud)