Given /^a user visits the signin page$/ do
visit signin_path
end
When /^he submits invalid signin information$/ do
click_button "Sign in"
end
Then /^he should see an error message$/ do
page.should have_selector('div.alert.alert-error')
end
Given /^the user has an account$/ do
@user = User.create(name: "Example User", email: "[email protected]",
password: "foobar", password_confirmation: "foobar")
end
When /^the user submits valid signin information$/ do
visit signin_path
fill_in "Email", with: @user.email
fill_in "Password", with: @user.password
click_button "Sign in"
end
Then /^he should see his profile page$/ do
page.should have_selector('title', text: @user.name)
end
Then /^he should see a signout link$/ do
page.should have_link('Sign out', href: signout_path)
end
我看了一下 Ruby on Rails Tutorial Sample App 里面的代码 有一个 features 文件夹下面有一个子文件夹下有一个文件 authentication_steps.rb 就是如上内容,请问这段内容有什么作用吗?看上去像是逻辑描述,请问在项目运行中起到什么作用吗?谢谢!