From e2bdd9aa0550b55c9c7940d75f8f48e8496ef524 Mon Sep 17 00:00:00 2001 From: Brad Watson Date: Fri, 17 Nov 2023 14:39:26 -0600 Subject: [PATCH] Valkyrizes spec/abilities/ability_spec.rb. (#6454) * Valkyrizes spec/abilities/ability_spec.rb. * swaps to wings disabled test. --- spec/abilities/ability_spec.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/abilities/ability_spec.rb b/spec/abilities/ability_spec.rb index 7e8ea163d7..ba351f67f3 100644 --- a/spec/abilities/ability_spec.rb +++ b/spec/abilities/ability_spec.rb @@ -98,9 +98,11 @@ it { is_expected.not_to be_able_to(:update, ContentBlock) } it { is_expected.not_to be_able_to(:create, AdminSet) } it { is_expected.to be_able_to(:read, ContentBlock) } - it { is_expected.to be_able_to(:read, GenericWork) } - it { is_expected.to be_able_to(:stats, GenericWork) } - it { is_expected.to be_able_to(:citation, GenericWork) } + unless Hyrax.config.disable_wings + it { is_expected.to be_able_to(:read, GenericWork) } + it { is_expected.to be_able_to(:stats, GenericWork) } + it { is_expected.to be_able_to(:citation, GenericWork) } + end end describe "a registered user" do @@ -134,7 +136,7 @@ let(:permission_template) { build(:permission_template, source_id: admin_set.id) } let(:permission_template_access) { build(:permission_template_access, permission_template: permission_template) } let(:user) { create(:user) } - let(:admin_set) { create(:admin_set) } + let(:admin_set) { valkyrie_create(:hyrax_admin_set) } RSpec.shared_examples 'A user with additional access' do it { is_expected.to be_able_to(:edit, admin_set) } @@ -154,7 +156,10 @@ end describe 'via AdminSet-specific edit_users' do - let(:admin_set) { create(:admin_set, with_permission_template: true, edit_users: [user]) } + let(:admin_set) { valkyrie_create(:hyrax_admin_set, edit_users: [user.user_key]) } + let(:permission_template) do + create(:permission_template, source_id: admin_set.id) + end it '#admin? is false' do expect(ability).not_to be_admin @@ -163,7 +168,7 @@ it 'A user who can manage an AdminSet' do create(:permission_template_access, :manage, - permission_template: admin_set.permission_template, + permission_template: permission_template, agent_type: 'user', agent_id: user.user_key) is_expected.to be_able_to(:manage_any, AdminSet)