Sha256: c946b5a37f9d2793f21bae0840c5dc530804781b531934c3523f5733ec2f028a

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Krikri::Indexer do
  before(:all) do
    DatabaseCleaner.clean_with(:truncation)
    create(:krikri_enrichment_activity)
  end

  subject { described_class.new(opts) }

  enrichment_gen_uri_str = 'http://example.org/ldp/activity/5'
  behaves_opts = { generator_uri: enrichment_gen_uri_str,
                   index_class:   'Krikri::QASearchIndex' }

  it_behaves_like 'a software agent', behaves_opts
  
  # See mapper_agent_spec.rb regarding :opts and behaves_opts...
  let(:opts) do
    { generator_uri: enrichment_gen_uri_str,
      index_class:   index_class.to_s }
  end

  let(:index_class) { Krikri::QASearchIndex }

  describe '::queue_name' do
    it { expect(described_class.queue_name.to_s).to eq 'indexing' }
  end

  describe '#run' do
    let(:agg) { build(:aggregation) }   # :aggregation defined in DPLA::MAP
    let(:entity_enum) { Array.new(3, agg) }
    
    before do
      allow(subject.generator_activity).to receive(:entities)
        .and_return(entity_enum)
    end

    it 'indexes records' do
      expect(subject.index).to receive(:update_from_activity)
                                .with(subject.generator_activity)
      subject.run
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
krikri-0.12.0 spec/lib/krikri/indexer_spec.rb
krikri-0.12.0.pre.rc.1 spec/lib/krikri/indexer_spec.rb
krikri-0.11.2 spec/lib/krikri/indexer_spec.rb
krikri-0.11.1 spec/lib/krikri/indexer_spec.rb
krikri-0.11.0 spec/lib/krikri/indexer_spec.rb
krikri-0.10.1 spec/lib/krikri/indexer_spec.rb
krikri-0.10.0 spec/lib/krikri/indexer_spec.rb
krikri-0.9.0 spec/lib/krikri/indexer_spec.rb
krikri-0.8.9 spec/lib/krikri/indexer_spec.rb
krikri-0.8.8 spec/lib/krikri/indexer_spec.rb
krikri-0.8.7 spec/lib/krikri/indexer_spec.rb
krikri-0.8.6 spec/lib/krikri/indexer_spec.rb
krikri-0.8.5 spec/lib/krikri/indexer_spec.rb
krikri-0.8.4 spec/lib/krikri/indexer_spec.rb
krikri-0.8.3 spec/lib/krikri/indexer_spec.rb