Sha256: d8aad2cdd8c9138b9fcd2648dff54e7792a626b5c381f2831f7ac93fbf6ea3d6

Contents?: true

Size: 516 Bytes

Versions: 7

Compression:

Stored size: 516 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "/../../../../spec_helper.rb"))

describe Mongoid::Extensions::Array::Parentization do

  describe "#parentize" do

    before do
      @parent = stub
      @child = mock
      @array = [@child]
    end

    it "sets the parent on each element" do
      @child.expects(:add_observer).with(@parent)
      @child.expects(:parent=).with(@parent)
      @child.expects(:association_name=).with(:child)
      @array.parentize(@parent, :child)
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mongoid-0.7.0 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.10 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.9 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.8 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.7 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.6 spec/unit/mongoid/extensions/array/parentization_spec.rb
mongoid-0.6.5 spec/unit/mongoid/extensions/array/parentization_spec.rb