Skip to content

Commit

Permalink
deps: use correct database_cleaner adapter per database
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Dec 1, 2024
1 parent 71055b9 commit 79b185d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ when 'mongoid' then
gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0'
gem 'mongoid-scroll'
gem 'mongoid-shell'

group :development, :test do
gem 'database_cleaner-mongoid', '~> 2.0.1'
end
when 'activerecord' then
gem 'activerecord', ENV['ACTIVERECORD_VERSION'] || '~> 6.0.0'
gem 'otr-activerecord'
gem 'pagy_cursor', '~> 0.6.1'
gem 'pg'

group :development, :test do
gem 'database_cleaner-active_record', '~> 2.2.0'
end
when nil
warn "Missing ENV['DATABASE_ADAPTER']."
else
Expand All @@ -23,7 +31,6 @@ group :development, :test do
gem 'bundler'
gem 'byebug'
gem 'capybara', '~> 3.36.0'
gem 'database_cleaner', '~> 2.1.0'
gem 'fabrication'
gem 'faker'
gem 'faraday', '0.17.5'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'database_cleaner'
require 'database_cleaner/active_record'

RSpec.configure do |config|
config.before :suite do
Expand Down
14 changes: 14 additions & 0 deletions spec/database_adapters/mongoid/database_cleaner.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'database_cleaner/mongoid'

RSpec.configure do |config|
config.before :suite do
DatabaseCleaner.strategy = :deletion
DatabaseCleaner.clean_with :deletion
end

config.around :each do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end

0 comments on commit 79b185d

Please sign in to comment.