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 30e2fcf
Show file tree
Hide file tree
Showing 2 changed files with 16 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
9 changes: 8 additions & 1 deletion spec/support/database_cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
require 'database_cleaner'
case ENV.fetch('DATABASE_ADAPTER', nil)
when 'activerecord'
require 'database_cleaner/active_record'
when 'mongoid'
require 'database_cleaner/mongoid'
else
raise "Unknown database adapter #{ENV.fetch('DATABASE_ADAPTER', nil)}"
end

RSpec.configure do |config|
config.before :suite do
Expand Down

0 comments on commit 30e2fcf

Please sign in to comment.