2009-03-01 03:45:58 -05:00
|
|
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
|
|
|
require 'database_cleaner/configuration'
|
2018-05-04 15:18:12 -04:00
|
|
|
require 'forwardable'
|
2009-03-05 00:11:58 -05:00
|
|
|
|
2013-05-27 17:53:36 -04:00
|
|
|
module DatabaseCleaner
|
2018-03-24 11:13:50 -04:00
|
|
|
class << self
|
2018-05-04 15:18:12 -04:00
|
|
|
extend Forwardable
|
|
|
|
delegate [
|
|
|
|
:[],
|
|
|
|
:app_root=,
|
|
|
|
:app_root,
|
|
|
|
:logger=,
|
|
|
|
:logger,
|
|
|
|
:strategy=,
|
|
|
|
:orm=,
|
|
|
|
:start,
|
|
|
|
:clean,
|
|
|
|
:clean_with,
|
|
|
|
:cleaning,
|
|
|
|
|
|
|
|
# TODO deprecate
|
|
|
|
:clean!,
|
|
|
|
:clean_with!,
|
|
|
|
|
|
|
|
# TODO deprecate and then privatize the following methods:
|
|
|
|
|
|
|
|
:init_cleaners,
|
|
|
|
:add_cleaner,
|
|
|
|
:connections,
|
|
|
|
:remove_duplicates,
|
|
|
|
] => :configuration
|
|
|
|
|
2018-04-20 11:34:21 -04:00
|
|
|
attr_accessor :allow_remote_database_url, :allow_production, :url_whitelist
|
2018-03-24 11:13:50 -04:00
|
|
|
|
|
|
|
def can_detect_orm?
|
|
|
|
DatabaseCleaner::Base.autodetect_orm
|
|
|
|
end
|
2018-05-04 15:18:12 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def configuration
|
|
|
|
@configuration ||= Configuration.new
|
|
|
|
end
|
2013-05-27 17:53:36 -04:00
|
|
|
end
|
|
|
|
end
|