Created
September 6, 2019 08:15
-
-
Save amitpatelx/17a477035490f183d2ee5fb2c1707fb1 to your computer and use it in GitHub Desktop.
Configure DatabaseCleaner for Rspec
This file contains hidden or 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.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.around(:each) do |example| | |
DatabaseCleaner.cleaning do | |
example.run | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment