Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Created September 6, 2019 08:15
Show Gist options
  • Save amitpatelx/17a477035490f183d2ee5fb2c1707fb1 to your computer and use it in GitHub Desktop.
Save amitpatelx/17a477035490f183d2ee5fb2c1707fb1 to your computer and use it in GitHub Desktop.
Configure DatabaseCleaner for Rspec
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment