Sha256: 6b3d84d964671cf878d03b865dbb70faa09e261dff0d9f3b44e76c11b8b346b2
Contents?: true
Size: 825 Bytes
Versions: 5
Compression:
Stored size: 825 Bytes
Contents
require "spec_helper" describe Mongoid::Relations::Cascading::Destroy do let(:person) do Person.new end let(:metadata) do double(name: :posts) end let(:strategy) do described_class.new(person, metadata) end describe "#cascade" do let(:post) do double end context "when the documents exist" do before do person.should_receive(:posts).and_return([ post ]) end it "destroys all documents in the relation" do post.should_receive(:destroy) strategy.cascade end end context "when no documents exist" do before do person.should_receive(:posts).and_return([]) end it "does not destroy anything" do post.should_receive(:destroy).never strategy.cascade end end end end
Version data entries
5 entries across 5 versions & 4 rubygems