Sha256: 613ee198068223aed34bc9d3987a7ee31d48f8eb78203c9ff59691e9ee500c74
Contents?: true
Size: 949 Bytes
Versions: 5
Compression:
Stored size: 949 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 expect(address_two._parent).to eq(person) end it "sets the inverse relation" do expect(address_two.addressable).to 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
5 entries across 5 versions & 4 rubygems