Skip to content

Instantly share code, notes, and snippets.

@ThroughTheNet
Created February 2, 2011 17:22
Show Gist options
  • Save ThroughTheNet/808025 to your computer and use it in GitHub Desktop.
Save ThroughTheNet/808025 to your computer and use it in GitHub Desktop.
# Adapted for Rspec2. This won't work in RSpec 1.
# Updated with new syntax to remove deprecation warnings
# Put this code in acceptance_helper.rb or better in a new file spec/acceptance/support/javascript.rb
RSpec.configure do |config|
config.before(:each) do
Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js]
end
config.after(:each) do
Capybara.use_default_driver if example.metadata[:js]
end
end
#...
scenario "Scenario that needs Javascript", :js => true do
#...
end
scenario "Scenario that doesn't need Javascript" do
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment