From 2c4e06aff62f8d1de85f7cd142c718163e5a7831 Mon Sep 17 00:00:00 2001 From: Micah Geisel Date: Sat, 1 Feb 2020 12:02:06 -0800 Subject: [PATCH 1/2] fix database_cleaner-ohm autodetected adapter loading. --- .../lib/database_cleaner/ohm/truncation.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb b/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb index a0d0adf..792e94a 100644 --- a/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb +++ b/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb @@ -1,4 +1,9 @@ -require 'database_cleaner/redis/truncation' +begin # when database_cleaner-ohm is loaded as a gem + require 'database_cleaner/redis/truncation' +rescue LoadError # when database_cleaner is loaded as a gem + $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../../../../../adapters/database_cleaner-redis/lib") + require 'database_cleaner/redis/truncation' +end module DatabaseCleaner module Ohm From 26815af3283d6aa3f14c1739568d334c57543252 Mon Sep 17 00:00:00 2001 From: Micah Geisel Date: Sat, 1 Feb 2020 12:05:15 -0800 Subject: [PATCH 2/2] deprecate ohm adapter. closes #618 --- adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb b/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb index 77cd718..4ad0600 100644 --- a/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb +++ b/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb @@ -2,6 +2,8 @@ require "database_cleaner/ohm/version" require "database_cleaner" require "database_cleaner/ohm/truncation" +DatabaseCleaner.deprecate "The Ohm adapter for DatabaseCleaner is deprecated, and will be removed in v2.0. Please use the Redis adapter instead." + module DatabaseCleaner::Ohm def self.default_strategy :truncation