From 8ea793d0199e6762b99572c8664cc704a85f1fbe Mon Sep 17 00:00:00 2001 From: rebuilt Date: Wed, 22 Mar 2023 17:07:07 -0700 Subject: [PATCH] Remove redundant DatabaseCleaner config setup --- spec/rails_helper.rb | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 80a425c9..ed5afeb6 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,11 +1,11 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../config/environment', __dir__) +ENV["RAILS_ENV"] ||= "test" +require File.expand_path("../config/environment", __dir__) # Prevent database truncation if the environment is production -abort('The Rails environment is running in production mode!') if Rails.env.production? -require 'spec_helper' -require 'rspec/rails' -Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } +abort("The Rails environment is running in production mode!") if Rails.env.production? +require "spec_helper" +require "rspec/rails" +Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in @@ -27,21 +27,9 @@ Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.maintain_test_schema! -require 'database_cleaner/active_record' +require "database_cleaner/active_record" RSpec.configure do |config| - config.before(:suite) do - DatabaseCleaner.strategy = :transaction - DatabaseCleaner.clean_with(:truncation) - end - - config.before(:each) do - DatabaseCleaner.start - end - - config.after(:each) do - DatabaseCleaner.clean - end # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures"