From b21137511858a903529ab9b15dc62bfe45be36bc Mon Sep 17 00:00:00 2001 From: bwatson78 Date: Fri, 17 Nov 2023 10:37:18 -0600 Subject: [PATCH 1/2] Valkyrizes spec/abilities/ability_spec.rb. --- 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..971e1dc875 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 I18n.t('hyrax.product_name') == 'Koppie' + 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) From 4e0ad59c45c8cfa87ffd28a433200ad9a84db0fc Mon Sep 17 00:00:00 2001 From: bwatson78 Date: Fri, 17 Nov 2023 13:42:18 -0600 Subject: [PATCH 2/2] swaps to wings disabled test. --- spec/abilities/ability_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/abilities/ability_spec.rb b/spec/abilities/ability_spec.rb index 971e1dc875..ba351f67f3 100644 --- a/spec/abilities/ability_spec.rb +++ b/spec/abilities/ability_spec.rb @@ -98,7 +98,7 @@ 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) } - unless I18n.t('hyrax.product_name') == 'Koppie' + 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) }