specs: remove database_cleaner

This is not needed for integration tests since Rails 5.1.

See https://www.nicholasjacques.io/blog/you-probably-dont-need-databasecleaner/
This commit is contained in:
Pierre de La Morinerie 2021-10-25 18:02:17 +02:00
parent b1eee27dd7
commit df9fa258ae
4 changed files with 1 additions and 32 deletions

View file

@ -90,7 +90,6 @@ group :test do
gem 'capybara-email' # Access emails during integration tests gem 'capybara-email' # Access emails during integration tests
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
gem 'capybara-selenium' gem 'capybara-selenium'
gem 'database_cleaner'
gem 'factory_bot' gem 'factory_bot'
gem 'launchy' gem 'launchy'
gem 'rails-controller-testing' gem 'rails-controller-testing'

View file

@ -189,12 +189,6 @@ GEM
css_parser (1.9.0) css_parser (1.9.0)
addressable addressable
daemons (1.3.1) daemons (1.3.1)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
datetime_picker_rails (0.0.7) datetime_picker_rails (0.0.7)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
deep_cloneable (3.0.0) deep_cloneable (3.0.0)
@ -804,7 +798,6 @@ DEPENDENCIES
chunky_png chunky_png
clamav-client clamav-client
daemons daemons
database_cleaner
deep_cloneable deep_cloneable
delayed_cron_job delayed_cron_job
delayed_job_active_record delayed_job_active_record

View file

@ -58,7 +58,7 @@ RSpec.configure do |config|
# If you're not using ActiveRecord, or you'd prefer not to run each of your # 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 # examples within a transaction, remove the following line or assign false
# instead of true. # instead of true.
config.use_transactional_fixtures = false config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests # RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and # based on their file location, for example enabling you to call `get` and

View file

@ -1,23 +0,0 @@
RSpec.configure do |config|
expect_list = []
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation, except: expect_list)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :deletion, { except: expect_list }
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end