Sha256: ff2296a8097b50d02d142219ffc3a9f6a8ba1f78b19b0402d560c34cbb32e77f

Contents?: true

Size: 964 Bytes

Versions: 10

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

describe Spotlight::ChangeVisibilityJob do
  subject { described_class.new(solr_params: solr_params, exhibit: exhibit, visibility: visibility) }

  let(:solr_params) { { q: 'map' } }
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:visibility) { 'private' }

  before do
    allow(Spotlight::Engine.config).to receive_messages(bulk_actions_batch_size: 5)
  end

  it 'sets the items based off of the visibility' do
    subject.perform_now
    response = exhibit.blacklight_config.repository.search(solr_params.merge('rows' => 999_999_999))
    expect(response.total).to eq 55
    expect(Spotlight::JobTracker.last).to have_attributes(
      status: 'completed',
      total: 55,
      progress: 55,
      job_class: 'Spotlight::ChangeVisibilityJob'
    )
    response.documents.each do |document|
      expect(document.private?(exhibit)).to be true
      document.make_public!(exhibit)
      document.reindex
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.3.0 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.2.0 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.1.0 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.3 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.2 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.1 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.0 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/jobs/spotlight/change_visibility_job_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/jobs/spotlight/change_visibility_job_spec.rb