Slide 46
Slide 46 text
Given /^the user "(.*?)" has an account$/ do |name|
@user = User.find_or_create_by_name name, password: "secret"
end
Given /^a logged-in user$/ do
@user = User.find_or_create_by_name "Fred", password: "secret"
visit "/login"
fill_in "User name", :with => @user.name
fill_in "Password", :with => @user.password
click_button "Log in"
end
When /^s?he logs in$/ do
visit "/login"
fill_in "User name", with: @user.name
fill_in "Password", with: @user.password
click_button "Log in"
end
Then /^s?he should see "(.*?)"$/ do |text|
page.should have_content(text)
end