Sha256: b30eda2c989e9d9fe5b02b39eec5da917dada1a06364de33876e6e0167dc4a05
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe ActiveFedora::Associations::HasManyAssociation do it "should be able to replace the collection" do @owner = stub(:new_record? => false) @reflection = stub(:klass => Mocha::Mock, :options=>{:property=>'predicate'}) #ac = ActiveFedora::Associations::AssociationCollection.new(@owner, @reflection) ac = ActiveFedora::Associations::HasManyAssociation.new(@owner, @reflection) @target = [stub(:new_record? => false, :remove_relationship=>true), stub(:new_record? => false, :remove_relationship=>true), stub(:new_record? => false, :remove_relationship=>true)] ac.target = @target @expected1 = stub(:new_record? => false, :add_relationship=>true, :save=>true) @expected2 = stub(:new_record? => false, :add_relationship=>true, :save=>true) ac.replace([@expected1, @expected2]) ac.target.should == [@expected1, @expected2] end it "should build" do class Foo; end @owner = stub(:new_record? => false) @assoc = ActiveFedora::Associations::HasManyAssociation.new(@owner, @reflection) @assoc.should respond_to :build end end
Version data entries
4 entries across 4 versions & 1 rubygems