mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
Merge pull request #284 from MartinNowak/master
Moped cleaner misses collections that have 'system' in their name
This commit is contained in:
commit
5d85717975
2 changed files with 13 additions and 2 deletions
|
@ -23,4 +23,10 @@ module MopedTest
|
|||
end
|
||||
class Gadget < ThingBase
|
||||
end
|
||||
class System < ThingBase
|
||||
def self.collection
|
||||
super
|
||||
@collection = @session['system_logs']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,12 +39,17 @@ module DatabaseCleaner
|
|||
MopedTest::Gadget.new({:name => 'some gadget'}.merge(attrs)).save!
|
||||
end
|
||||
|
||||
def create_system(attrs={})
|
||||
MopedTest::System.new({:name => 'some system'}.merge(attrs)).save!
|
||||
end
|
||||
|
||||
it "truncates all collections by default" do
|
||||
create_widget
|
||||
create_gadget
|
||||
ensure_counts(MopedTest::Widget => 1, MopedTest::Gadget => 1)
|
||||
create_system
|
||||
ensure_counts(MopedTest::Widget => 1, MopedTest::Gadget => 1, MopedTest::System => 1)
|
||||
truncation.clean
|
||||
ensure_counts(MopedTest::Widget => 0, MopedTest::Gadget => 0)
|
||||
ensure_counts(MopedTest::Widget => 0, MopedTest::Gadget => 0, MopedTest::System => 0)
|
||||
end
|
||||
|
||||
context "when collections are provided to the :only option" do
|
||||
|
|
Loading…
Reference in a new issue