Last active
January 2, 2018 09:02
-
-
Save isuke/11d050d93759fa6eb4b6 to your computer and use it in GitHub Desktop.
The best of database_cleaner setting
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| | |
# Use transactions by default | |
config.before :each do | |
DatabaseRewinder.strategy = :transaction | |
end | |
# Switch to truncation for javascript tests, but *only clean used tables* | |
config.before :each, js: true do | |
DatabaseRewinder.strategy = :truncation, {pre_count: true} | |
end | |
config.before :each do | |
DatabaseRewinder.start | |
end | |
config.after :each do | |
DatabaseRewinder.clean | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment