Skip to content

Instantly share code, notes, and snippets.

@0x7466
Created November 7, 2015 18:13
Show Gist options
  • Save 0x7466/c47c6771ae3a33b4a8c4 to your computer and use it in GitHub Desktop.
Save 0x7466/c47c6771ae3a33b4a8c4 to your computer and use it in GitHub Desktop.
Database cleaner configuration with default behavior
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