Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created September 5, 2012 16:15
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 brianjlandau/3639233 to your computer and use it in GitHub Desktop.
Save brianjlandau/3639233 to your computer and use it in GitHub Desktop.
Setting up for using JS driver in RSpec
config.before(:each, :type => :request) do
if example.metadata[:js]
self.class.use_transactional_fixtures = false
end
end
config.after(:each, :type => :request) do
if example.metadata[:js]
self.class.use_transactional_fixtures = true
DatabaseCleaner.clean # Truncate the database
Capybara.reset_sessions! # Forget the (simulated) browser state
Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment