Skip to content

Instantly share code, notes, and snippets.

@robertsosinski
Created May 2, 2012 15:29
Show Gist options
  • Save robertsosinski/2577498 to your computer and use it in GitHub Desktop.
Save robertsosinski/2577498 to your computer and use it in GitHub Desktop.
Sign in a user for capybara tests
module RSpecHelpers
module InstanceMethods
def sign_in(user=nil)
user ||= User.make
fill_in 'user[email]', :with => user.email
fill_in 'user[password]', :with => user.password
click_button 'Sign in'
end
end
end
RSpec.configure do |config|
config.include(RSpecHelpers::InstanceMethods)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment