Skip to content

Commit

Permalink
Merge pull request #2608 from sul-dlss/fix-failing-test
Browse files Browse the repository at this point in the history
Mock Solr response so we don't need to index a document
  • Loading branch information
dnoneill authored Oct 15, 2024
2 parents ef04314 + b67f5ea commit ae9b2a3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions spec/controllers/spotlight/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@

let(:exhibit) { create(:exhibit) }
let(:user) { create(:exhibit_admin, exhibit: exhibit) }
let(:document) { SolrDocument.new(id: '1') }
let(:search_service) { instance_double(Blacklight::SearchService, fetch: [document]) }

before do
sign_in user
allow(Blacklight::SearchService).to receive(:new).and_return(search_service)
end

describe '#manifest' do
it 'sets appropriate CORS headers' do
uploaded_resource = FactoryBot.create(:uploaded_resource)
compound_id = uploaded_resource.compound_id

perform_enqueued_jobs do
uploaded_resource.save_and_index
end

get :manifest, params: { id: compound_id, exhibit_id: exhibit.id, locale: 'en' }
get :manifest, params: { id: document.id, exhibit_id: exhibit.id, locale: 'en' }

expect(response.headers.to_h).to include 'access-control-allow-origin' => '*'
end
Expand Down

0 comments on commit ae9b2a3

Please sign in to comment.