Sha256: 26e80686ae30e7418886912abed99f8ee5ed9392e5aaa338297ad947f19ca92d

Contents?: true

Size: 839 Bytes

Versions: 5

Compression:

Stored size: 839 Bytes

Contents

require 'spec_helper'

describe Hydra::PCDM::CollectionIndexer do
  let(:collection) { Hydra::PCDM::Collection.new }
  let(:collection_ids) { %w(123 456) }
  let(:object_ids) { ['789'] }
  let(:member_ids) { %w(123 456 789) }
  let(:indexer) { described_class.new(collection) }

  before do
    allow(collection).to receive(:ordered_collection_ids).and_return(collection_ids)
    allow(collection).to receive(:ordered_object_ids).and_return(object_ids)
    allow(collection).to receive(:member_ids).and_return(member_ids)
  end

  describe '#generate_solr_document' do
    subject { indexer.generate_solr_document }

    it 'has fields' do
      expect(subject['collection_ids_ssim']).to eq %w(123 456)
      expect(subject['object_ids_ssim']).to eq ['789']
      expect(subject['member_ids_ssim']).to eq %w(123 456 789)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hydra-pcdm-0.5.0 spec/hydra/pcdm/collection_indexer_spec.rb
hydra-pcdm-0.4.0 spec/hydra/pcdm/collection_indexer_spec.rb
hydra-pcdm-0.3.2 spec/hydra/pcdm/collection_indexer_spec.rb
hydra-pcdm-0.3.1 spec/hydra/pcdm/collection_indexer_spec.rb
hydra-pcdm-0.3.0 spec/hydra/pcdm/collection_indexer_spec.rb