Skip to content

Instantly share code, notes, and snippets.

@robbl
Created October 7, 2013 14:40
Show Gist options
  • Save robbl/6869107 to your computer and use it in GitHub Desktop.
Save robbl/6869107 to your computer and use it in GitHub Desktop.
safe database cleaner strategy
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before :suite do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(: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