Sha256: b8476b0eb7ae545211cd26961e30e840149457c411e1566290f79b10a2efb4fe

Contents?: true

Size: 976 Bytes

Versions: 16

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::Associations::HasManyAssociation do
  it "should be able to replace the collection" do
    @owner = stub(:new_record? => false, :to_ary => nil, :internal_uri => 'info:fedora/changeme:99')
    @reflection = stub(:klass => mock.class, :options=>{:property=>'predicate'}, :class_name=> nil)
    ac = ActiveFedora::Associations::HasManyAssociation.new(@owner, @reflection)
    @target = [stub(:to_ary => nil, :new_record? => false, :remove_relationship=>true), stub(:to_ary => nil, :new_record? => false, :remove_relationship=>true), stub(:to_ary => nil, :new_record? => false, :remove_relationship=>true)]
    ac.target = @target 

    @expected1 = stub(:new_record? => false, :add_relationship=>true, :save=>true, :to_ary => nil)
    @expected2 = stub(:new_record? => false, :add_relationship=>true, :save=>true, :to_ary => nil)
    ac.replace([@expected1, @expected2])
    ac.target.should == [@expected1, @expected2]

  end


end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
active-fedora-6.0.0 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc7 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc6 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc5 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc4 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc3 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc2 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.rc1 spec/unit/has_many_collection_spec.rb
active-fedora-5.6.2 spec/unit/has_many_collection_spec.rb
active-fedora-5.6.1 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre10 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre9 spec/unit/has_many_collection_spec.rb
active-fedora-5.6.0 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre8 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre7 spec/unit/has_many_collection_spec.rb
active-fedora-5.5.2 spec/unit/has_many_collection_spec.rb