spec/unit/mongoid/commands/destroy_spec.rb in mongoid-1.2.8 vs spec/unit/mongoid/commands/destroy_spec.rb in mongoid-1.2.9
- old
+ new
@@ -27,13 +27,16 @@
before do
@parent = Person.new
@address = Address.new(:street => "Genoa Pl")
@parent.addresses << @address
+ @collection = mock
+ Person.expects(:collection).returns(@collection)
end
it "removes the document from the parent attributes" do
@parent.addresses.should == [@address]
+ @collection.expects(:save).returns(true)
Mongoid::Commands::Destroy.execute(@address)
@parent.addresses.should be_empty
end
end