Sha256: da3b049b46e24580d52c6571a441eb7470b85ddc1a66f5c6cd18473d15b1725d

Contents?: true

Size: 957 Bytes

Versions: 27

Compression:

Stored size: 957 Bytes

Contents

require 'spec_helper'

describe Spotlight::ReindexJob do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:resource) { FactoryGirl.create(:resource) }

  before do
    allow_any_instance_of(Spotlight::Resource).to receive(:reindex)
  end

  context 'with an exhibit' do
    subject { described_class.new(exhibit) }

    before do
      exhibit.resources << resource
      exhibit.save
    end
    it 'attempts to reindex every resource in the exhibit' do
      # ActiveJob will reload the collection, so we go through a little trouble:
      expect_any_instance_of(Spotlight::Resource).to receive(:reindex) do |thingy|
        expect(exhibit.resources).to include thingy
      end

      subject.perform_now
    end
  end

  context 'with a resource' do
    subject { described_class.new(resource) }

    it 'attempts to reindex every resource in the exhibit' do
      expect(resource).to receive(:reindex)
      subject.perform_now
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
blacklight-spotlight-0.18.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.17.1 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.17.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.16.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.15.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.14.2 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.14.1 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.14.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.13.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.12.1 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.12.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.11.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.10.3 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.10.2 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.10.1 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.10.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.9.2 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.9.1 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.9.0 spec/jobs/spotlight/reindex_job_spec.rb
blacklight-spotlight-0.8.2 spec/jobs/spotlight/reindex_job_spec.rb