Sha256: 8b007bc22ed1ea9d5434dc74f418df9f8b8a8ba2b5c43625136cf98d91448fde

Contents?: true

Size: 860 Bytes

Versions: 13

Compression:

Stored size: 860 Bytes

Contents

require 'spec_helper'

RSpec.describe Component, type: :model, components: true do

  it_behaves_like "a DDR model"
  it_behaves_like "an object that can have content"
  it_behaves_like "it has an association", :belongs_to, :parent, :is_part_of, "Item"
  it_behaves_like "it has an association", :belongs_to, :target, :has_external_target, "Target"
  it_behaves_like "a non-collection model"

  describe "indexing" do
    let(:component) { FactoryGirl.build(:component) }
    before do
      allow_any_instance_of(Component).to receive(:collection) { Collection.new(pid: 'test:1') }
    end
    it "should include the COLLECTION_URI field in its indexing" do
      expect(component.index_fields).to have_key(Ddr::IndexFields::COLLECTION_URI)
      expect(component.index_fields[Ddr::IndexFields::COLLECTION_URI]).to eq('info:fedora/test:1')
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ddr-models-2.0.1 spec/models/component_spec.rb
ddr-models-2.0.0 spec/models/component_spec.rb
ddr-models-2.0.0.rc6 spec/models/component_spec.rb
ddr-models-2.0.0.rc5 spec/models/component_spec.rb
ddr-models-2.0.0.rc4 spec/models/component_spec.rb
ddr-models-2.0.0.rc3 spec/models/component_spec.rb
ddr-models-2.0.0.rc2 spec/models/component_spec.rb
ddr-models-2.0.0.rc1 spec/models/component_spec.rb
ddr-models-2.0.0.pre.5 spec/models/component_spec.rb
ddr-models-2.0.0.pre.4 spec/models/component_spec.rb
ddr-models-2.0.0.pre.3 spec/models/component_spec.rb
ddr-models-2.0.0.pre.2 spec/models/component_spec.rb
ddr-models-2.0.0.pre.1 spec/models/component_spec.rb