database_cleaner/lib/database_cleaner.rb

46 lines
935 B
Ruby
Raw Normal View History

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
require 'database_cleaner/configuration'
require 'forwardable'
2013-05-27 17:53:36 -04:00
module DatabaseCleaner
class << self
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
def can_detect_orm?
DatabaseCleaner::Base.autodetect_orm
end
private
def configuration
@configuration ||= Configuration.new
end
2013-05-27 17:53:36 -04:00
end
end