-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,4 +75,5 @@ group :test do | |
gem "webdrivers" | ||
gem 'factory_bot_rails' | ||
gem 'faker' | ||
gem 'database_cleaner-active_record' | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'database_cleaner/active_record' | ||
|
||
RSpec.configure do |config| | ||
# start by truncating all the tables but then use the faster transaction strategy the rest of the time. | ||
config.before(:suite) do | ||
DatabaseCleaner.clean_with(:truncation) | ||
DatabaseCleaner.strategy = :transaction | ||
end | ||
|
||
# start the transaction strategy as examples are run | ||
config.around(:each) do |example| | ||
DatabaseCleaner.cleaning do | ||
example.run | ||
end | ||
end | ||
end |