Skip to content

Instantly share code, notes, and snippets.

@stephanschubert
Created May 29, 2014 20:00
Show Gist options
  • Save stephanschubert/cc71790f7291549039e0 to your computer and use it in GitHub Desktop.
Save stephanschubert/cc71790f7291549039e0 to your computer and use it in GitHub Desktop.
Configuring database_cleaner with Rails, RSpec, Capybara and Selenium -- http://devblog.avdi.org/2012/08/31/configuring-database_cleaner-with-rails-rspec-capybara-and-selenium/
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment