Sha256: 79dd849e49486b30e9614c07258e3a27e7f53929a18decfded48b6b06b8965d9

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe CurationConcerns::CollectionIndexer do
  let(:indexer) { described_class.new(collection) }
  let(:collection) { build(:collection) }
  let(:col1id) { 'col1' }
  let(:col2id) { 'col2' }
  let(:col1title) { 'col1 title' }
  let(:col2title) { 'col2 title' }
  let(:col1) { double('collection') }
  let(:col2) { double('collection') }

  describe "#generate_solr_document" do
    before do
      allow(collection).to receive(:bytes).and_return(1000)
      allow(collection).to receive(:in_collections).and_return([col1, col2])
      allow(col1).to receive(:id).and_return(col1id)
      allow(col2).to receive(:id).and_return(col2id)
      allow(col1).to receive(:first_title).and_return(col1title)
      allow(col2).to receive(:first_title).and_return(col2title)

      allow(CurationConcerns::ThumbnailPathService).to receive(:call).and_return("/downloads/1234?file=thumbnail")
    end
    subject { indexer.generate_solr_document }

    it "has required fields" do
      expect(subject.fetch('generic_type_sim')).to eq ["Collection"]
      expect(subject.fetch('bytes_lts')).to eq(1000)
      expect(subject.fetch('thumbnail_path_ss')).to eq "/downloads/1234?file=thumbnail"
      expect(subject.fetch('member_of_collection_ids_ssim')).to eq [col1id, col2id]
      expect(subject.fetch('member_of_collections_ssim')).to eq [col1title, col2title]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curation_concerns-2.0.0 spec/indexers/collection_indexer_spec.rb
curation_concerns-2.0.0.rc2 spec/indexers/collection_indexer_spec.rb
curation_concerns-2.0.0.rc1 spec/indexers/collection_indexer_spec.rb