Skip to content

Instantly share code, notes, and snippets.

@shekibobo
Created February 3, 2016 05:44
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 shekibobo/9394a93d89690dd64be1 to your computer and use it in GitHub Desktop.
Save shekibobo/9394a93d89690dd64be1 to your computer and use it in GitHub Desktop.
Capybara to toggle poltergeist/selenium in RSpec features
require "capybara/poltergeist"
Capybara.asset_host = "http://localhost:3000"
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new app, js_errors: true
end
Capybara.javascript_driver = :poltergeist
RSpec.configure do |config|
config.before(:each, touchy_js: true) do
Capybara.current_driver = :selenium
end
config.after(:each, touchy_js: true) do
Capybara.use_default_driver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment