Skip to content

Instantly share code, notes, and snippets.

@robbl
Created October 7, 2013 15:40
Show Gist options
  • Save robbl/6869997 to your computer and use it in GitHub Desktop.
Save robbl/6869997 to your computer and use it in GitHub Desktop.
safe database cleaner config, second attempt
RSpec.configure do |config|
config.use_transactional_fixtures = false
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, truncation: 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