Sha256: 10793e91803771bb71689258091c72cc13c74b5154afae3413229dccd8433163
Contents?: true
Size: 827 Bytes
Versions: 37
Compression:
Stored size: 827 Bytes
Contents
require "spec_helper" describe Mongoid::Commands::Delete do describe "#execute" do before do @collection = mock @document = stub(:collection => @collection, :id => "1", :_parent => false) end it "removes the document from its collection" do @collection.expects(:remove).with({ :_id => @document.id }) Mongoid::Commands::Delete.execute(@document) end context "when the document is embedded" do before do @parent = Person.new @address = Address.new(:street => "Genoa Pl") @parent.addresses << @address end it "removes the document from the parent attributes" do @parent.addresses.should == [@address] Mongoid::Commands::Delete.execute(@address) @parent.addresses.should be_empty end end end end
Version data entries
37 entries across 37 versions & 2 rubygems