Created
June 4, 2013 13:57
-
-
Save fjfish/5706122 to your computer and use it in GitHub Desktop.
Method to create a session object with poltergeist so you can play with it in IRB
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
# load this file to create a method that creates a capybara session you can play | |
# with in irb | |
require 'capybara' | |
require 'capybara/poltergeist' | |
require 'ext/capybara/session' | |
def session(driver = :poltergeist) | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, timeout:60) | |
end | |
# Don't boot a rack application - we are running against remote server | |
Capybara.run_server = false | |
@_capybara_session ||= begin | |
Capybara::Session.new(driver.to_sym) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment