Skip to content

Commit

Permalink
Remove DatabaseCleaner
Browse files Browse the repository at this point in the history
user rails_transactional_fixtures

see: #913
  • Loading branch information
jparr committed Apr 18, 2024
1 parent f899add commit 739b27f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 19 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ end
group :development, :test do
gem "byebug"
gem "capybara", "~> 3"
gem "database_cleaner", "~> 1"
gem "factory_bot_rails", "~> 6.2"
gem "rails-controller-testing"
gem "rspec-rails", "~> 6.1"
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ GEM
css_parser (1.16.0)
addressable
daemons (1.4.1)
database_cleaner (1.99.0)
date (3.3.4)
delayed_job (4.1.11)
activesupport (>= 3.0, < 8.0)
Expand Down Expand Up @@ -529,7 +528,6 @@ DEPENDENCIES
cocoon (~> 1)
counter_culture (~> 2.0)
daemons (~> 1)
database_cleaner (~> 1)
delayed_job_active_record (~> 4)
devise (~> 4.7)
dotenv-rails (~> 2)
Expand Down
10 changes: 5 additions & 5 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@

# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
# begin
# DatabaseCleaner.strategy = :transaction
# rescue NameError
# raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
# end

# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
Expand Down
8 changes: 1 addition & 7 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# 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.use_transactional_fixtures = false
config.use_transactional_fixtures = true

# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
Expand All @@ -64,12 +64,6 @@
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!

config.before(:suite) { DatabaseCleaner.clean_with(:truncation) }
config.before(:each) { DatabaseCleaner.strategy = :transaction }
config.before(:each, js: true) { DatabaseCleaner.strategy = :truncation }
config.before(:each) { DatabaseCleaner.start }
config.append_after(:each) { DatabaseCleaner.clean }

config.before(:each, type: :feature) do
# disable call tool by default; it will be stubbed for tests that need it
disable_call_tool
Expand Down
4 changes: 0 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }

RSpec.configure do |config|
config.before(:each) do
DatabaseCleaner.clean_with :truncation
end

# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
Expand Down

0 comments on commit 739b27f

Please sign in to comment.