Module: DatabaseCleaner

Defined in:
lib/database_cleaner/configuration.rb,
lib/database_cleaner/truncation_base.rb

Defined Under Namespace

Modules: ActiveRecord, DataMapper Classes: NoORMDetected, NoStrategySetError, TruncationBase, UnknownStrategySpecified

Class Method Summary collapse

Class Method Details

.cleanObject



51
52
53
# File 'lib/database_cleaner/configuration.rb', line 51

def clean
  strategy.clean
end

.clean_with(*args) ⇒ Object



26
27
28
29
30
# File 'lib/database_cleaner/configuration.rb', line 26

def clean_with(*args)
  strategy = create_strategy(*args)
  strategy.clean
  strategy
end

.create_strategy(*args) ⇒ Object



21
22
23
24
# File 'lib/database_cleaner/configuration.rb', line 21

def create_strategy(*args)
  strategy, *strategy_args = args
  orm_strategy(strategy).new(*strategy_args)
end

.orm=(orm_string) ⇒ Object



43
44
45
# File 'lib/database_cleaner/configuration.rb', line 43

def orm=(orm_string)
  @orm = orm_string
end

.startObject



47
48
49
# File 'lib/database_cleaner/configuration.rb', line 47

def start
  strategy.start
end

.strategy=(args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/database_cleaner/configuration.rb', line 32

def strategy=(args)
  strategy, *strategy_args = args
   if strategy.is_a?(Symbol)
      @strategy = create_strategy(*args)
   elsif strategy_args.empty?
     @strategy = strategy
   else
     raise ArgumentError, "You must provide a strategy object, or a symbol for a know strategy along with initialization params."
   end
end