Sha256: 5b23b2e7e96a025fc9c682c5dcf7e31cccb74fc1712c1eb378a727cb776b651f
Contents?: true
Size: 841 Bytes
Versions: 54
Compression:
Stored size: 841 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 expect(person).to receive(:posts).and_return([ post ]) end it "destroys all documents in the relation" do expect(post).to receive(:destroy) strategy.cascade end end context "when no documents exist" do before do expect(person).to receive(:posts).and_return([]) end it "does not destroy anything" do expect(post).to receive(:destroy).never strategy.cascade end end end end
Version data entries
54 entries across 49 versions & 3 rubygems