Sha256: ba13a74538f590d03b0e2c2982c342c5673f0b073b89a30c623d5e0005391c1b

Contents?: true

Size: 1.02 KB

Versions: 21

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 => Mocha::Mock, :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

21 entries across 21 versions & 1 rubygems

Version Path
active-fedora-5.1.0 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0.rc5 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0.rc4 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0.rc3 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0.rc2 spec/unit/has_many_collection_spec.rb
active-fedora-5.0.0.rc1 spec/unit/has_many_collection_spec.rb
active-fedora-4.6.0.rc4 spec/unit/has_many_collection_spec.rb
active-fedora-4.6.0.rc3 spec/unit/has_many_collection_spec.rb
active-fedora-4.6.0.rc2 spec/unit/has_many_collection_spec.rb
active-fedora-4.6.0.rc1 spec/unit/has_many_collection_spec.rb
active-fedora-4.5.3 spec/unit/has_many_collection_spec.rb
active-fedora-4.5.2 spec/unit/has_many_collection_spec.rb
active-fedora-4.5.1 spec/unit/has_many_collection_spec.rb
active-fedora-4.5.0 spec/unit/has_many_collection_spec.rb
active-fedora-4.4.1 spec/unit/has_many_collection_spec.rb
active-fedora-4.4.0 spec/unit/has_many_collection_spec.rb
active-fedora-4.3.0 spec/unit/has_many_collection_spec.rb
active-fedora-4.2.0 spec/unit/has_many_collection_spec.rb
active-fedora-4.1.0 spec/unit/has_many_collection_spec.rb