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