Skip to content

Instantly share code, notes, and snippets.

@joe11051105
Forked from jsteiner/database_cleaner.rb
Created November 10, 2016 06:16
Show Gist options
  • Save joe11051105/a981bf00eaf4665b09dc700ec5a2c6ba to your computer and use it in GitHub Desktop.
Save joe11051105/a981bf00eaf4665b09dc700ec5a2c6ba to your computer and use it in GitHub Desktop.
Database Cleaner
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