Created
May 2, 2012 15:29
-
-
Save robertsosinski/2577498 to your computer and use it in GitHub Desktop.
Sign in a user for capybara tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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