Sha256: 2ffad99315d5f7c8497c384896939b7c4b4e75bf2a01b672e50627120f134a92

Contents?: true

Size: 678 Bytes

Versions: 59

Compression:

Stored size: 678 Bytes

Contents

require "spec_helper"

describe Mongoid::Extensions::Array::Assimilation do

  describe "#assimilate" do

    before do
      @address_one = { :street => "Circular Quay" }
      @address_two = Address.new(:street => "King St.")
      @parent = Person.new(:title => "Mr.")
      @options = Mongoid::Associations::Options.new(:name => :addresses)
      @child = [@address_one, @address_two]
    end

    it "incorporates the hash into the object graph" do
      @child.assimilate(@parent, @options)
      @parent.addresses.size.should == 2
      @parent.addresses.first.street.should == "Circular Quay"
      @parent.addresses.last.street.should == "King St."
    end

  end

end

Version data entries

59 entries across 59 versions & 3 rubygems

Version Path
mongoid-locomotive-2.0.0.beta9 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-pre-2.0.0.beta1 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-2.0.0.alpha spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.14 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.13 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.12 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.11 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.10 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.9 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.8 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.7 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-pre-2.0.0.pre spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.6 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.5 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.4 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.3 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.2 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.1 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.2.0 spec/unit/mongoid/extensions/array/assimilation_spec.rb
mongoid-1.1.4 spec/unit/mongoid/extensions/array/assimilation_spec.rb