Skip to content

Instantly share code, notes, and snippets.

@fjfish
Created June 4, 2013 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjfish/5706122 to your computer and use it in GitHub Desktop.
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
# 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