Merge pull request #284 from MartinNowak/master

Moped cleaner misses collections that have 'system' in their name
This commit is contained in:
Ernesto Tagwerker 2014-08-29 15:43:01 -03:00
commit 5d85717975
2 changed files with 13 additions and 2 deletions

View file

@ -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

View file

@ -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