Skip to content

Commit

Permalink
Merge pull request #6476 from samvera/updates_collections_search_buil…
Browse files Browse the repository at this point in the history
…der_spec

Adds switches between AF and Valkyrie expected classes.
  • Loading branch information
dlpierce authored Nov 30, 2023
2 parents 9e4f61e + d157a52 commit 4020941
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions spec/search_builders/hyrax/my/collections_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
end
let(:user) { create(:user) }
let(:builder) { described_class.new(context) }
let(:admin_klass) { Hyrax.config.disable_wings ? Hyrax::AdministrativeSet : AdminSet }
let(:expected_klasses) do
if Hyrax.config.disable_wings
[AdminSet, Hyrax::AdministrativeSet, Hyrax::PcdmCollection]
else
[AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax::PcdmCollection]
end
end

describe '#models' do
subject { builder.models }
Expand All @@ -23,12 +31,7 @@

context 'when collection class is something other than ::Collection' do
before { allow(Hyrax.config).to receive(:collection_model).and_return('Hyrax::PcdmCollection') }
it do
is_expected.to contain_exactly(AdminSet,
Hyrax::AdministrativeSet,
::Collection,
Hyrax::PcdmCollection)
end
it { is_expected.to contain_exactly(*expected_klasses) }
end
end

Expand All @@ -46,7 +49,7 @@
it "has filter that excludes depositor" do
subject
expect(solr_params[:fq]).to eq ["(_query_:\"{!terms f=depositor_ssim}#{user.user_key}\" " \
"OR (_query_:\"{!terms f=has_model_ssim}AdminSet\" " \
"OR (_query_:\"{!terms f=has_model_ssim}#{admin_klass}\" " \
"AND _query_:\"{!terms f=creator_ssim}#{user.user_key}\"))"]
end
end
Expand Down

0 comments on commit 4020941

Please sign in to comment.