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