Sha256: 467e821d1ac1358756bb7dcc7eb8a474208b687b4b0142cdedd91e2a693a49c7
Contents?: true
Size: 1.13 KB
Versions: 23
Compression:
Stored size: 1.13 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 Object.send(:remove_const, :Foo) end end
Version data entries
23 entries across 23 versions & 1 rubygems