Skip to content

Commit

Permalink
mark ActiveFedora-specific AdminSet ability tests as :active_fedroa
Browse files Browse the repository at this point in the history
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.
38 changes: 18 additions & 20 deletions spec/abilities/admin_set_ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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) }

Expand Down Expand Up @@ -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) }

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f19386

Please sign in to comment.