Skip to content

Instantly share code, notes, and snippets.

@donbonifacio
Created July 31, 2013 08:37
Show Gist options
  • Save donbonifacio/6120384 to your computer and use it in GitHub Desktop.
Save donbonifacio/6120384 to your computer and use it in GitHub Desktop.
//top of steps file or in seperate factory file
require 'factory_girl'
Factory.define :user do |u|
u.login 'the_login'
u.email '[email protected]'
u.password 'password'
u.password_confirmation 'password'
# u.activated_at 'active'
end
// in steps file
Given /I am logged in as a user/ do
user = Factory(:user)
#when registration required
#user.register!
user.activate!
visits "/login"
fill_in("login", :with => user.login)
fill_in("password", :with => user.password)
click_button("Log in")
response.body.should =~ /Logged in successfully/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment