Skip to content

Instantly share code, notes, and snippets.

@bacarini
Last active June 21, 2016 21:04
Show Gist options
  • Save bacarini/4f48bc7c4b0bb1e41e95b47b37622432 to your computer and use it in GitHub Desktop.
Save bacarini/4f48bc7c4b0bb1e41e95b47b37622432 to your computer and use it in GitHub Desktop.
spec/support/database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner[:sequel].strategy = :transaction
end
config.before(:each) do
DatabaseCleaner[:sequel, {:connection => MyApp::SequelDb.main_db}].start
DatabaseCleaner[:sequel, {:connection => MyApp::SequelDb.alt_db}].start
end
config.after(:each) do
DatabaseCleaner[:sequel, {:connection => MyApp::SequelDb.main_db}].clean
DatabaseCleaner[:sequel, {:connection => MyApp::SequelDb.alt_db}].clean
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment