Last active
June 21, 2016 21:04
-
-
Save bacarini/4f48bc7c4b0bb1e41e95b47b37622432 to your computer and use it in GitHub Desktop.
spec/support/database_cleaner.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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