.available_strategies should be part of the adapter contract.

This commit is contained in:
Micah Geisel 2018-05-23 01:25:42 -07:00
parent 29b444cec4
commit 63f3c47964
2 changed files with 5 additions and 5 deletions

View file

@ -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
end
retry
end

View file

@ -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