Created
January 19, 2017 04:29
-
-
Save anxhe/0d6c9d893b4f5c3a552b4d7fbb57d724 to your computer and use it in GitHub Desktop.
Capybara Cheatsheet
This file contains 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 AuthHelper | |
def sign_in_with_cookie(name, value) | |
case page.driver.class | |
when Capybara::RackTest::Driver | |
# Set session cookie using Rack::Test | |
page.driver.browser.env "rack.session", { name => value } | |
else | |
# Set session cookie using railsware/rack_session_access gem | |
page.set_rack_session(name => value) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment