Skip to content

Instantly share code, notes, and snippets.

@patricksrobertson
Forked from HeroicEric/gist:1402144
Created November 28, 2011 21:28
Show Gist options
  • Save patricksrobertson/1402155 to your computer and use it in GitHub Desktop.
Save patricksrobertson/1402155 to your computer and use it in GitHub Desktop.
describe "GET /users" do
it "lists users if you are logged in" do
user1 = Factory(:user, name: "Elliot Stabler")
user2 = Factory(:user, name: "Olivia Benson")
login_user(user1)
login_user(user2)
visit users_path
page.should_have content(user1.name)
page.should_have content(user2.name)
end
end
# extract me into a support file for reusability!
def login_user(user)
visit new_user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
click_button "Sign in"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment