Sha256: a51bf2cb9bc008d4d20a700e7c20eb804db2b4b589d407f98c0231d7ba02ee84

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

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'})
    #ac = ActiveFedora::Associations::AssociationCollection.new(@owner, @reflection)
    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

15 entries across 15 versions & 1 rubygems

Version Path
active-fedora-6.0.0.pre6 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre5 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre4 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre3 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre2 spec/unit/has_many_collection_spec.rb
active-fedora-5.5.1 spec/unit/has_many_collection_spec.rb
active-fedora-6.0.0.pre1 spec/unit/has_many_collection_spec.rb
active-fedora-5.5.0 spec/unit/has_many_collection_spec.rb
active-fedora-5.5.0.rc2 spec/unit/has_many_collection_spec.rb
active-fedora-5.5.0.rc1 spec/unit/has_many_collection_spec.rb
active-fedora-5.4.0 spec/unit/has_many_collection_spec.rb
active-fedora-5.3.1 spec/unit/has_many_collection_spec.rb
active-fedora-5.3.0 spec/unit/has_many_collection_spec.rb
active-fedora-5.2.1 spec/unit/has_many_collection_spec.rb
active-fedora-5.2.0 spec/unit/has_many_collection_spec.rb