diff --git a/app/services/sufia/admin_set_create_service.rb b/app/services/sufia/admin_set_create_service.rb index a9b065e0f3..758965152d 100644 --- a/app/services/sufia/admin_set_create_service.rb +++ b/app/services/sufia/admin_set_create_service.rb @@ -1,19 +1,18 @@ module Sufia # Creates AdminSets class AdminSetCreateService - DEFAULT_ID = 'admin_sets/default'.freeze DEFAULT_WORKFLOW_NAME = 'default'.freeze def self.create_default! - return if AdminSet.exists?(DEFAULT_ID) - admin_set = AdminSet.new(id: DEFAULT_ID, title: ['Default Admin Set']) + return if AdminSet.exists?(AdminSet::DEFAULT_ID) + admin_set = AdminSet.new(id: AdminSet::DEFAULT_ID, title: ['Default Admin Set']) begin new(admin_set, nil, DEFAULT_WORKFLOW_NAME).create rescue ActiveFedora::IllegalOperation # It is possible that another thread created the AdminSet just before this method # was called, so ActiveFedora will raise IllegalOperation. In this case we can safely # ignore the error. - Rails.logger.error("AdminSet ID=#{DEFAULT_ID} may or may not have been created due to threading issues.") + Rails.logger.error("AdminSet ID=#{AdminSet::DEFAULT_ID} may or may not have been created due to threading issues.") end end diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index 83f4be9037..520c514185 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -2,7 +2,7 @@ namespace :sufia do namespace :migrate do task move_all_works_to_admin_set: :environment do require 'sufia/move_all_works_to_admin_set' - MoveAllWorksToAdminSet.run(AdminSet.find(Sufia::DefaultAdminSetActor::DEFAULT_ID)) + MoveAllWorksToAdminSet.run(AdminSet.find(AdminSet::DEFAULT_ID)) end desc "Migrate workflow data from 7.3.0.rc1" diff --git a/spec/services/sufia/admin_set_create_service_spec.rb b/spec/services/sufia/admin_set_create_service_spec.rb index efd609e6cd..d7e83d2f62 100644 --- a/spec/services/sufia/admin_set_create_service_spec.rb +++ b/spec/services/sufia/admin_set_create_service_spec.rb @@ -31,7 +31,7 @@ end describe '.create_default!' do - let(:default_admin_set_id) { 'admin_sets/default' } + let(:default_admin_set_id) { 'admin_set/default' } let(:permission_template) { Sufia::PermissionTemplate.find_by!(admin_set_id: default_admin_set_id) } # It is important to test the side-effects as a default admin set is a fundamental assumption for Sufia >= 7.3 it 'creates AdminSet, PermissionTemplate' do