-
-
Save mateusg/9138787 to your computer and use it in GitHub Desktop.
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| | |
# If you're not using ActiveRecord, or you'd prefer not to run each of your | |
# examples within a transaction, remove the following line or assign false | |
# instead of true. | |
config.before :suite do | |
DatabaseCleaner.clean_with :truncation | |
end | |
config.before :each do | |
if example.metadata[:js] || example.metadata[:truncation] | |
config.use_transactional_fixtures = false | |
DatabaseCleaner.strategy = :truncation | |
else | |
config.use_transactional_fixtures = true | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.start | |
end | |
end | |
config.after :each do | |
if example.metadata[:js] | |
DatabaseCleaner.clean_with :truncation | |
else | |
DatabaseCleaner.clean_with :transaction | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment