Skip to content

Commit

Permalink
Added check for repository being called with Search Builder
Browse files Browse the repository at this point in the history
Knowing that this stuff is fiddley I just played with it a bit to get a working version.  No intention of leaving the Ensemble out just wanted to get the syntax correct.
  • Loading branch information
carolyncole authored and hackartisan committed Nov 7, 2023
1 parent 194ed50 commit 31bb7ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@
# We want to make sure that the repository (in
# controller.blacklight_config.repository) receives search with an
# instance of SearchBuilder.
allow(AlternateSearchBuilder).to receive(:new).and_call_original

repository = CatalogController.blacklight_config.repository
allow(repository).to receive(:search).and_call_original
allow_any_instance_of(Blacklight::Configuration).to receive(:repository).and_return(repository)
get :index, params: { q: "coffee" }

expect(AlternateSearchBuilder).not_to have_received(:new)
expect(repository).to have_received(:search).with(instance_of(SearchBuilder))
end
end

Expand Down

0 comments on commit 31bb7ad

Please sign in to comment.