-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mark ActiveFedora-specific AdminSet ability tests as :active_fedroa
this partially addresses #6189. the rest appears to be specific to `.koppie` and maybe related to index setup?
- Loading branch information
tamsin johnson
authored and
tamsin johnson
committed
Aug 29, 2023
1 parent
84f9524
commit 2f19386
Showing
1 changed file
with
18 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,16 @@ | |
require 'cancan/matchers' | ||
|
||
RSpec.describe Hyrax::Ability, :clean_repo do | ||
subject { ability } | ||
|
||
let(:ability) { Ability.new(current_user) } | ||
let(:user) { create(:user, email: '[email protected]') } | ||
subject(:ability) { Ability.new(current_user) } | ||
let(:admin) { FactoryBot.create(:admin, email: '[email protected]') } | ||
let(:user) { FactoryBot.create(:user, email: '[email protected]') } | ||
let(:current_user) { user } | ||
|
||
context 'when admin user' do | ||
let(:current_user) { admin } | ||
let(:admin) { FactoryBot.create(:admin, email: '[email protected]') } | ||
|
||
context 'and admin set is an ActiveFedora::Base' do | ||
let(:admin_set) { create(:adminset_lw, user: user, with_permission_template: true) } | ||
context 'and admin set is an ActiveFedora::Base', :active_fedora do | ||
let(:admin_set) { FactoryBot.create(:adminset_lw, user: user, with_permission_template: true) } | ||
let!(:solr_document) { SolrDocument.new(admin_set.to_solr) } | ||
|
||
context 'for abilities open to admins' do | ||
|
@@ -65,18 +63,18 @@ | |
|
||
context 'when admin set manager' do | ||
let(:current_user) { manager } | ||
let(:manager) { create(:user, email: '[email protected]') } | ||
let(:manager) { FactoryBot.create(:user, email: '[email protected]') } | ||
|
||
context 'and admin set is an ActiveFedora::Base' do | ||
let!(:admin_set) { create(:adminset_lw, id: 'as_mu', user: user, with_permission_template: true) } | ||
context 'and admin set is an ActiveFedora::Base', :active_fedora do | ||
let!(:admin_set) { FactoryBot.create(:adminset_lw, id: 'as_mu', user: user, with_permission_template: true) } | ||
let!(:solr_document) { SolrDocument.new(admin_set.to_solr) } | ||
|
||
before do | ||
create(:permission_template_access, | ||
:manage, | ||
permission_template: admin_set.permission_template, | ||
agent_type: 'user', | ||
agent_id: manager.user_key) | ||
FactoryBot.create(:permission_template_access, | ||
:manage, | ||
permission_template: admin_set.permission_template, | ||
agent_type: 'user', | ||
agent_id: manager.user_key) | ||
admin_set.permission_template.reset_access_controls_for(collection: admin_set) | ||
end | ||
|
||
|
@@ -147,7 +145,7 @@ | |
let(:current_user) { depositor } | ||
let(:depositor) { create(:user, email: '[email protected]') } | ||
|
||
context 'and admin set is an ActiveFedora::Base' do | ||
context 'and admin set is an ActiveFedora::Base', :active_fedora do | ||
let!(:admin_set) { create(:adminset_lw, id: 'as_du', user: user, with_permission_template: true) } | ||
let!(:solr_document) { SolrDocument.new(admin_set.to_solr) } | ||
|
||
|
@@ -235,7 +233,7 @@ | |
let(:current_user) { viewer } | ||
let(:viewer) { create(:user, email: '[email protected]') } | ||
|
||
context 'and admin set is an ActiveFedora::Base' do | ||
context 'and admin set is an ActiveFedora::Base', :active_fedora do | ||
let!(:admin_set) { create(:adminset_lw, id: 'as_vu', user: user, with_permission_template: true) } | ||
let!(:solr_document) { SolrDocument.new(admin_set.to_solr) } | ||
|
||
|
@@ -319,10 +317,10 @@ | |
|
||
context 'when user has no special access' do | ||
let(:current_user) { other_user } | ||
let(:other_user) { create(:user, email: '[email protected]') } | ||
let(:other_user) { FactoryBot.create(:user, email: '[email protected]') } | ||
|
||
context 'and admin set is an ActiveFedora::Base' do | ||
let(:admin_set) { create(:adminset_lw, id: 'as', user: user, with_permission_template: true) } | ||
context 'and admin set is an ActiveFedora::Base', :active_fedora do | ||
let(:admin_set) { FactoryBot.create(:adminset_lw, id: 'as', user: user, with_permission_template: true) } | ||
let!(:solr_document) { SolrDocument.new(admin_set.to_solr) } | ||
|
||
context 'for abilities NOT open to general user' do | ||
|