Sha256: 432f144c2c53147ae0218b45106390a947616828de29aa711fd5dc21157b6158

Contents?: true

Size: 666 Bytes

Versions: 8

Compression:

Stored size: 666 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::Associations::HasManyAssociation do
  it "should call add_relationship" do
    subject = stub("subject", :new_record? => false, :pid => 'subject:a', :internal_uri => 'info:fedora/subject:a')
    predicate = stub(:klass => mock.class, :options=>{:property=>'predicate'}, :class_name=> nil)
    ActiveFedora::SolrService.stub(:query).and_return([])
    ac = ActiveFedora::Associations::HasManyAssociation.new(subject, predicate)
    object = stub("object", :new_record? => false, :pid => 'object:b', :save => nil)
  
    object.should_receive(:add_relationship).with('predicate', subject)
 
    ac << object

  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active-fedora-6.4.2 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.1 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.0 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.0.rc4 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.0.rc3 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.0.rc2 spec/unit/has_many_collection_spec.rb
active-fedora-6.4.0.rc1 spec/unit/has_many_collection_spec.rb
active-fedora-6.3.0 spec/unit/has_many_collection_spec.rb