class DatabaseCleaner::Cleaner
def self.available_strategies(orm_module)
def self.available_strategies(orm_module) # introspect publically available constants for descendents of Strategy to get list of strategies # ignore classes named Base, because its a common name for a shared base class that adds ORM access stuff to Strategy before being inherited by final concrete class # if you're writing an adapter and this method is falsely returning an internal constant that isn't a valid strategy, consider making it private with Module#private_constant. orm_module.constants.select do |constant_name| ancestors = orm_module.const_get(constant_name).ancestors rescue [] ancestors.include?(DatabaseCleaner::Strategy) end.map do |constant_name| underscore(constant_name).to_sym end - [:base] end