Skip to content

Commit

Permalink
Valkyrizes spec/abilities/ability_spec.rb. (#6454)
Browse files Browse the repository at this point in the history
* Valkyrizes spec/abilities/ability_spec.rb.

* swaps to wings disabled test.
  • Loading branch information
bwatson78 authored Nov 17, 2023
1 parent d1e58dc commit e2bdd9a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions spec/abilities/ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) }
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit e2bdd9a

Please sign in to comment.