Sha256: 4196197f7fddbcd15431d132956898176158fe7a4098be1d566c960a48cf0ce6

Contents?: true

Size: 932 Bytes

Versions: 6

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

describe CurationConcerns::WorkIndexer do
  # TODO: file_set_ids returns an empty set unless you persist the work
  let(:user) { create(:user) }
  let!(:generic_work) { create(:work_with_one_file, user: user) }
  let!(:child_work) { create(:generic_work, user: user) }
  let(:service) { described_class.new(generic_work) }
  let(:file) { generic_work.file_sets.first }

  before do
    generic_work.works << child_work
    allow(CurationConcerns::ThumbnailPathService).to receive(:call).and_return("/downloads/#{file.id}?file=thumbnail")
    generic_work.representative_id = file.id
  end

  subject { service.generate_solr_document }

  it 'indexes member work and file_set ids' do
    expect(subject['member_ids_ssim']).to eq generic_work.member_ids
    expect(subject['generic_type_sim']).to eq ['Work']
    expect(subject.fetch('thumbnail_path_ss')).to eq "/downloads/#{file.id}?file=thumbnail"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
curation_concerns-0.9.0 spec/indexers/work_indexer_spec.rb
curation_concerns-0.8.0 spec/indexers/work_indexer_spec.rb
curation_concerns-0.7.0 spec/indexers/work_indexer_spec.rb
curation_concerns-0.6.0 spec/indexers/work_indexer_spec.rb
curation_concerns-0.5.0 spec/indexers/work_indexer_spec.rb
curation_concerns-0.4.0 spec/indexers/work_indexer_spec.rb