Change strategy method implementation to return a Hash.

This commit is contained in:
Ernesto Tagwerker 2021-10-18 22:13:36 -04:00
parent 933df38680
commit e8d2c031ea

View file

@ -13,17 +13,23 @@ module DatabaseCleaner
fetch([orm, opts]) { add_cleaner(orm, **opts) }
end
# It returns a hash with all the strategies associated with
# all the cleaners.
#
# For example:
#
# ```
# cleaners.strategy
# => {
# :active_record_1 => :truncation,
# :active_record_2 => :truncation,
# :data_mapper_1 => :truncation
# }
# ```
#
# @return [Hash]
def strategy
strategies = transform_values(&:strategy)
case strategies.values.uniq.compact.count
when 0
nil
when 1
strategies.values.first
else
strategies
end
transform_values(&:strategy)
end
def strategy=(strategy)