Skip to content

Commit

Permalink
Merge pull request #6508 from samvera/valk-perm-tmpl-form
Browse files Browse the repository at this point in the history
Adapt permission_template_form_spec for valkyire
  • Loading branch information
abelemlih authored Dec 6, 2023
2 parents 3558c20 + 30e6466 commit 7b12a1c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spec/forms/hyrax/forms/permission_template_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
let(:permission_template) { build(:permission_template) }
let(:form) { described_class.new(permission_template) }
let(:today) { Time.zone.today }
let(:admin_set) { create(:admin_set) }
let(:collection) { build(:collection_lw) }
let(:admin_set) { valkyrie_create(:hyrax_admin_set) }

subject { form }

Expand Down Expand Up @@ -183,7 +182,8 @@ def count_workflow_roles_for(user)
expect(count_workflow_roles_for(user)).to eq 1
expect(count_workflow_roles_for(user2)).to eq 1
expect(count_workflow_roles_for(user3)).to eq 0
expect(admin_set.reload.edit_users).to match_array [user2.user_key, user.user_key]
reload = Hyrax.query_service.find_by id: admin_set.id
expect(reload.edit_users).to match_array [user2.user_key, user.user_key]
end
end

Expand All @@ -196,7 +196,8 @@ def count_workflow_roles_for(user)

it "also adds edit_access to the AdminSet itself" do
expect { subject }.to change { permission_template.access_grants.count }.by(1)
expect(admin_set.reload.edit_groups).to match_array ['bob', 'archivists']
reload = Hyrax.query_service.find_by id: admin_set.id
expect(reload.edit_groups).to match_array ['bob', 'archivists']
end
end

Expand All @@ -210,7 +211,8 @@ def count_workflow_roles_for(user)

it "doesn't adds edit_access to the AdminSet itself" do
expect { subject }.to change { permission_template.access_grants.count }.by(1)
expect(admin_set.reload.edit_users).to match_array [user.user_key] # MANAGE user added in before do
reload = Hyrax.query_service.find_by id: admin_set.id
expect(reload.edit_users).to match_array [user.user_key] # MANAGE user added in before do
end
end

Expand Down

0 comments on commit 7b12a1c

Please sign in to comment.