From 63f3c47964e9ced42a87c9412bef8be151ee6ff6 Mon Sep 17 00:00:00 2001 From: Micah Geisel Date: Wed, 23 May 2018 01:25:42 -0700 Subject: [PATCH] .available_strategies should be part of the adapter contract. --- lib/database_cleaner/base.rb | 6 +----- lib/database_cleaner/ohm/truncation.rb | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/database_cleaner/base.rb b/lib/database_cleaner/base.rb index 8ce49f0..9691cf6 100644 --- a/lib/database_cleaner/base.rb +++ b/lib/database_cleaner/base.rb @@ -168,11 +168,7 @@ module DatabaseCleaner begin require "database_cleaner/#{orm.to_s}/#{strategy.to_s}" rescue LoadError - if orm_module.respond_to?(:available_strategies) - raise UnknownStrategySpecified, "The '#{strategy}' strategy does not exist for the #{orm} ORM! Available strategies: #{orm_module.available_strategies.join(', ')}" - else - raise UnknownStrategySpecified, "The '#{strategy}' strategy does not exist for the #{orm} ORM!" - end + raise UnknownStrategySpecified, "The '#{strategy}' strategy does not exist for the #{orm} ORM! Available strategies: #{orm_module.available_strategies.join(', ')}" end retry end diff --git a/lib/database_cleaner/ohm/truncation.rb b/lib/database_cleaner/ohm/truncation.rb index 1747a32..a0d0adf 100644 --- a/lib/database_cleaner/ohm/truncation.rb +++ b/lib/database_cleaner/ohm/truncation.rb @@ -2,6 +2,10 @@ require 'database_cleaner/redis/truncation' module DatabaseCleaner module Ohm + def self.available_strategies + %w(truncation) + end + class Truncation < ::DatabaseCleaner::Redis::Truncation private