diff --git a/spec/search_builders/hyrax/collection_search_builder_spec.rb b/spec/search_builders/hyrax/collection_search_builder_spec.rb index 2310a8e08f..68e276e201 100644 --- a/spec/search_builders/hyrax/collection_search_builder_spec.rb +++ b/spec/search_builders/hyrax/collection_search_builder_spec.rb @@ -49,22 +49,31 @@ context 'when access is :deposit' do let(:access) { "deposit" } - let!(:collection) { FactoryBot.create(:collection_lw, with_permission_template: attributes) } + let(:access_grant) do + { agent_type:, + agent_id: user.user_key, + access: Hyrax::PermissionTemplateAccess::DEPOSIT} + end + let!(:collection) do + valkyrie_create(:hyrax_collection, user: user, access_grants: [access_grant]) + end context 'and user has access' do - let(:attributes) { { deposit_users: [user.user_key] } } + let(:agent_type) { Hyrax::PermissionTemplateAccess::USER } it { is_expected.to eq ["{!terms f=id}#{collection.id}"] } end context 'and group has access' do - let(:attributes) { { deposit_groups: ['registered'] } } + let(:agent_type) { Hyrax::PermissionTemplateAccess::GROUP } it { is_expected.to eq ["{!terms f=id}#{collection.id}"] } end context "and user has no access" do - let(:attributes) { true } + let(:collection) do + valkyrie_create(:hyrax_collection, :with_permission_template) + end it { is_expected.to eq ["{!terms f=id}"] } end