Module: DatabaseCleaner
- Defined in:
- lib/database_cleaner/configuration.rb,
lib/database_cleaner/truncation_base.rb,
lib/database_cleaner/couch_potato/truncation.rb,
lib/database_cleaner/mongo_mapper/truncation.rb
Defined Under Namespace
Modules: ActiveRecord, CouchPotato, DataMapper, MongoMapper
Classes: NoORMDetected, NoStrategySetError, TruncationBase, UnknownStrategySpecified
Class Method Summary
collapse
Class Method Details
.clean ⇒ Object
Also known as:
clean!
74
75
76
|
# File 'lib/database_cleaner/configuration.rb', line 74
def clean
strategy.clean
end
|
.clean_with(*args) ⇒ Object
Also known as:
clean_with!
47
48
49
50
51
|
# File 'lib/database_cleaner/configuration.rb', line 47
def clean_with(*args)
strategy = create_strategy(*args)
strategy.clean
strategy
end
|
.create_strategy(*args) ⇒ Object
42
43
44
45
|
# File 'lib/database_cleaner/configuration.rb', line 42
def create_strategy(*args)
strategy, *strategy_args = args
orm_strategy(strategy).new(*strategy_args)
end
|
.orm=(orm_string) ⇒ Object
66
67
68
|
# File 'lib/database_cleaner/configuration.rb', line 66
def orm=(orm_string)
@orm = orm_string
end
|
.start ⇒ Object
70
71
72
|
# File 'lib/database_cleaner/configuration.rb', line 70
def start
strategy.start
end
|
.strategy=(args) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/database_cleaner/configuration.rb', line 55
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
|