Sha256: 592110837b3c5c8ac4c836464d3d663951a7449e08e085c72b705dc66961c328
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
require "spec_helper" describe Mongoid::Relations::Bindings::Embedded::Many do let(:person) do Person.new end let(:address) do Address.new end let(:target) do [ address ] end let(:metadata) do Person.relations["addresses"] end describe "#bind_one" do let(:binding) do described_class.new(person, target, metadata) end context "when the document is bindable" do let(:address_two) do Address.new end before do binding.bind_one(address_two) end it "parentizes the document" do address_two._parent.should eq(person) end it "sets the inverse relation" do address_two.addressable.should eq(person) end end context "when the document is not bindable" do it "does nothing" do person.addresses.should_receive(:<<).never binding.bind_one(address) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems