hyrax 2.0.0.rc1 → 2.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +5 -1
- data/app/assets/stylesheets/hyrax/_header.scss +6 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -1
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -3
- data/app/controllers/hyrax/collections_controller.rb +2 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +113 -48
- data/app/jobs/ingest_local_file_job.rb +0 -1
- data/app/renderers/hyrax/renderers/rights_statement_attribute_renderer.rb +25 -0
- data/app/search_builders/hyrax/deposit_search_builder.rb +6 -3
- data/app/search_builders/hyrax/stats/work_status_search_builder.rb +4 -5
- data/app/services/hyrax/default_middleware_stack.rb +0 -1
- data/app/services/hyrax/file_set_derivatives_service.rb +13 -4
- data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
- data/app/services/hyrax/workflow/abstract_notification.rb +3 -2
- data/app/services/hyrax/workflow/notification_service.rb +3 -12
- data/app/services/hyrax/workflow/permission_query.rb +3 -3
- data/app/services/hyrax/workflow/status_list_service.rb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -0
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +3 -0
- data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +1 -0
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -0
- data/config/locales/hyrax.de.yml +7 -3
- data/config/locales/hyrax.en.yml +16 -12
- data/config/locales/hyrax.es.yml +4 -0
- data/config/locales/hyrax.fr.yml +4 -0
- data/config/locales/hyrax.it.yml +4 -0
- data/config/locales/hyrax.pt-BR.yml +4 -0
- data/config/locales/hyrax.zh.yml +4 -0
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +1 -1
- data/lib/hyrax/configuration.rb +11 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/abilities/file_set_abilities_spec.rb +3 -3
- data/spec/abilities/generic_work_abilities_spec.rb +5 -5
- data/spec/actors/hyrax/actors/generic_work_actor_spec.rb +12 -12
- data/spec/actors/hyrax/actors/transactional_request_spec.rb +1 -1
- data/spec/controllers/hyrax/api/items_controller_spec.rb +6 -6
- data/spec/controllers/hyrax/citations_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/collections_controller_spec.rb +1 -0
- data/spec/controllers/hyrax/content_blocks_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/profiles_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/downloads_controller_spec.rb +3 -3
- data/spec/controllers/hyrax/featured_work_lists_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/homepage_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/pages_controller_spec.rb +6 -6
- data/spec/controllers/hyrax/users_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/workflow_actions_controller_spec.rb +1 -1
- data/spec/conversions/power_converters/polymorphic_type_spec.rb +1 -1
- data/spec/factories/admin_sets.rb +1 -1
- data/spec/factories/api_items.rb +1 -1
- data/spec/factories/collections_factory.rb +2 -2
- data/spec/factories/content_blocks.rb +1 -1
- data/spec/factories/featured_works.rb +1 -1
- data/spec/factories/file_sets.rb +3 -3
- data/spec/factories/generic_works.rb +15 -15
- data/spec/factories/operations.rb +1 -1
- data/spec/factories/permission_template_accesses.rb +1 -1
- data/spec/factories/permission_templates.rb +1 -1
- data/spec/factories/proxy_deposit_requests.rb +2 -2
- data/spec/factories/single_use_links.rb +1 -1
- data/spec/factories/sipity_entities.rb +1 -1
- data/spec/factories/uploaded_files.rb +1 -1
- data/spec/factories/users.rb +2 -2
- data/spec/factories/workflow_actions.rb +1 -1
- data/spec/factories/workflow_states.rb +1 -1
- data/spec/factories/workflows.rb +1 -1
- data/spec/features/notifications_spec.rb +1 -1
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +113 -2
- data/spec/helpers/hyrax/collections_helper_spec.rb +2 -2
- data/spec/helpers/hyrax/content_block_helper_spec.rb +1 -1
- data/spec/helpers/hyrax/trophy_helper_spec.rb +1 -1
- data/spec/jobs/create_derivatives_job_spec.rb +3 -4
- data/spec/jobs/ingest_local_file_job_spec.rb +2 -5
- data/spec/lib/hyrax/arkivo/actor_spec.rb +2 -2
- data/spec/lib/hyrax/arkivo/metadata_munger_spec.rb +1 -1
- data/spec/lib/hyrax/arkivo/schema_validator_spec.rb +1 -1
- data/spec/lib/hyrax/configuration_spec.rb +4 -0
- data/spec/models/file_set_spec.rb +1 -1
- data/spec/models/generic_work_spec.rb +1 -1
- data/spec/models/hyrax/user_usage_stats_spec.rb +1 -1
- data/spec/models/sipity/entity_spec.rb +1 -1
- data/spec/models/user_spec.rb +7 -7
- data/spec/presenters/hyrax/admin/users_presenter_spec.rb +2 -2
- data/spec/renderers/hyrax/renderers/rights_statement_attribute_renderer_spec.rb +20 -0
- data/spec/search_builders/hyrax/stats/work_status_search_builder_spec.rb +12 -12
- data/spec/services/hyrax/default_middleware_stack_spec.rb +0 -1
- data/spec/services/hyrax/embargo_service_spec.rb +4 -4
- data/spec/services/hyrax/workflow/notification_service_spec.rb +0 -35
- data/spec/services/hyrax/workflow/permission_generator_spec.rb +1 -1
- data/spec/services/hyrax/workflow/status_list_service_spec.rb +12 -0
- data/spec/spec_helper.rb +6 -6
- data/spec/support/features/session_helpers.rb +1 -1
- data/spec/views/hyrax/admin/users/index.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_attribute_rows.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/file_manager.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/collections/show.html.erb_spec.rb +23 -5
- data/spec/views/pages/show.html.erb_spec.rb +1 -1
- data/template.rb +1 -1
- metadata +8 -6
- data/app/actors/hyrax/actors/assign_representative_actor.rb +0 -22
|
@@ -58,7 +58,7 @@ RSpec.describe Hyrax::GenericWorksController do
|
|
|
58
58
|
expect(controller).to receive(:add_breadcrumb).with('test title', main_app.hyrax_generic_work_path(work.id, locale: 'en'))
|
|
59
59
|
get :show, params: { id: work }
|
|
60
60
|
expect(response).to be_successful
|
|
61
|
-
expect(response).to render_template("layouts/hyrax")
|
|
61
|
+
expect(response).to render_template("layouts/hyrax/1_column")
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -98,7 +98,7 @@ RSpec.describe Hyrax::HomepageController, type: :controller do
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
context "with featured works" do
|
|
101
|
-
let!(:my_work) {
|
|
101
|
+
let!(:my_work) { FactoryBot.create(:work, user: user) }
|
|
102
102
|
|
|
103
103
|
before do
|
|
104
104
|
FeaturedWork.create!(work_id: my_work.id)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
RSpec.describe Hyrax::PagesController, type: :controller do
|
|
2
|
-
let(:user) {
|
|
2
|
+
let(:user) { FactoryBot.create(:user) }
|
|
3
3
|
|
|
4
4
|
before do
|
|
5
5
|
sign_in user
|
|
@@ -34,16 +34,16 @@ RSpec.describe Hyrax::PagesController, type: :controller do
|
|
|
34
34
|
end
|
|
35
35
|
context 'when editing pages' do
|
|
36
36
|
let!(:about_page) do
|
|
37
|
-
|
|
37
|
+
FactoryBot.create(:content_block, name: 'about_page')
|
|
38
38
|
end
|
|
39
39
|
let!(:help_page) do
|
|
40
|
-
|
|
40
|
+
FactoryBot.create(:content_block, name: 'help_page')
|
|
41
41
|
end
|
|
42
42
|
let!(:agreement_page) do
|
|
43
|
-
|
|
43
|
+
FactoryBot.create(:content_block, name: 'agreement_page')
|
|
44
44
|
end
|
|
45
45
|
let!(:terms_page) do
|
|
46
|
-
|
|
46
|
+
FactoryBot.create(:content_block, name: 'terms_page')
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
context 'with an unprivileged user' do
|
|
@@ -63,7 +63,7 @@ RSpec.describe Hyrax::PagesController, type: :controller do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
context 'with an administrator' do
|
|
66
|
-
let(:user) {
|
|
66
|
+
let(:user) { FactoryBot.create(:admin) }
|
|
67
67
|
|
|
68
68
|
describe "GET #edit" do
|
|
69
69
|
it "renders breadcrumbs and dashboard layout" do
|
|
@@ -81,7 +81,7 @@ RSpec.describe Hyrax::UsersController, type: :controller do
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "uses the base query" do
|
|
84
|
-
u3 =
|
|
84
|
+
u3 = FactoryBot.create(:user)
|
|
85
85
|
allow(controller).to receive(:base_query).and_return(["email == \"#{u3.email}\""])
|
|
86
86
|
get :index
|
|
87
87
|
expect(assigns[:users]).to include(u3)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
RSpec.describe Hyrax::WorkflowActionsController, type: :controller do
|
|
2
|
-
let(:user) {
|
|
2
|
+
let(:user) { FactoryBot.create(:user) }
|
|
3
3
|
let(:generic_work) { stub_model(GenericWork, id: '123') }
|
|
4
4
|
let(:form) { instance_double(Hyrax::Forms::WorkflowActionForm) }
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ RSpec.describe 'PowerConverter', no_clean: true do
|
|
|
7
7
|
expect(PowerConverter.convert_to_polymorphic_type(object)).to eq(:symbol)
|
|
8
8
|
end
|
|
9
9
|
it 'will convert an ActiveRecord::Base object' do
|
|
10
|
-
user =
|
|
10
|
+
user = FactoryBot.build(:user)
|
|
11
11
|
expect(PowerConverter.convert_to_polymorphic_type(user)).to eq(user.class)
|
|
12
12
|
end
|
|
13
13
|
it 'will convert an object that responds to #base_class' do
|
data/spec/factories/api_items.rb
CHANGED
data/spec/factories/file_sets.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
FactoryBot.define do
|
|
2
2
|
factory :file_set do
|
|
3
3
|
transient do
|
|
4
|
-
user {
|
|
4
|
+
user { FactoryBot.create(:user) }
|
|
5
5
|
content nil
|
|
6
6
|
end
|
|
7
7
|
after(:build) do |fs, evaluator|
|
|
@@ -30,7 +30,7 @@ FactoryGirl.define do
|
|
|
30
30
|
if evaluator.content
|
|
31
31
|
Hydra::Works::UploadFileToFileSet.call(file, evaluator.content)
|
|
32
32
|
end
|
|
33
|
-
|
|
33
|
+
FactoryBot.create(:generic_work, user: evaluator.user).members << file
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
FactoryBot.define do
|
|
2
2
|
factory :work, aliases: [:generic_work, :private_generic_work], class: GenericWork do
|
|
3
3
|
transient do
|
|
4
|
-
user {
|
|
4
|
+
user { FactoryBot.create(:user) }
|
|
5
5
|
# Set to true (or a hash) if you want to create an admin set
|
|
6
6
|
with_admin_set false
|
|
7
7
|
end
|
|
@@ -37,45 +37,45 @@ FactoryGirl.define do
|
|
|
37
37
|
|
|
38
38
|
factory :work_with_one_file do
|
|
39
39
|
before(:create) do |work, evaluator|
|
|
40
|
-
work.ordered_members <<
|
|
40
|
+
work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user, title: ['A Contained FileSet'], label: 'filename.pdf')
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
factory :work_with_files do
|
|
45
|
-
before(:create) { |work, evaluator| 2.times { work.ordered_members <<
|
|
45
|
+
before(:create) { |work, evaluator| 2.times { work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user) } }
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
factory :work_with_ordered_files do
|
|
49
49
|
before(:create) do |work, evaluator|
|
|
50
|
-
work.ordered_members <<
|
|
51
|
-
work.ordered_member_proxies.insert_target_at(0,
|
|
50
|
+
work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user)
|
|
51
|
+
work.ordered_member_proxies.insert_target_at(0, FactoryBot.create(:file_set, user: evaluator.user))
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
factory :work_with_one_child do
|
|
56
56
|
before(:create) do |work, evaluator|
|
|
57
|
-
work.ordered_members <<
|
|
57
|
+
work.ordered_members << FactoryBot.create(:generic_work, user: evaluator.user, title: ['A Contained Work'])
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
factory :work_with_two_children do
|
|
62
62
|
before(:create) do |work, evaluator|
|
|
63
|
-
work.ordered_members <<
|
|
64
|
-
work.ordered_members <<
|
|
63
|
+
work.ordered_members << FactoryBot.create(:generic_work, user: evaluator.user, title: ['A Contained Work'], id: "BlahBlah1")
|
|
64
|
+
work.ordered_members << FactoryBot.create(:generic_work, user: evaluator.user, title: ['Another Contained Work'], id: "BlahBlah2")
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
factory :work_with_representative_file do
|
|
69
69
|
before(:create) do |work, evaluator|
|
|
70
|
-
work.ordered_members <<
|
|
70
|
+
work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user, title: ['A Contained FileSet'])
|
|
71
71
|
work.representative_id = work.members[0].id
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
factory :work_with_file_and_work do
|
|
76
76
|
before(:create) do |work, evaluator|
|
|
77
|
-
work.ordered_members <<
|
|
78
|
-
work.ordered_members <<
|
|
77
|
+
work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user)
|
|
78
|
+
work.ordered_members << FactoryBot.create(:generic_work, user: evaluator.user)
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -90,7 +90,7 @@ FactoryGirl.define do
|
|
|
90
90
|
end
|
|
91
91
|
factory :embargoed_work_with_files do
|
|
92
92
|
after(:build) { |work, evaluator| work.apply_embargo(evaluator.embargo_date, evaluator.current_state, evaluator.future_state) }
|
|
93
|
-
after(:create) { |work, evaluator| 2.times { work.ordered_members <<
|
|
93
|
+
after(:create) { |work, evaluator| 2.times { work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user) } }
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -105,7 +105,7 @@ FactoryGirl.define do
|
|
|
105
105
|
end
|
|
106
106
|
factory :leased_work_with_files do
|
|
107
107
|
after(:build) { |work, evaluator| work.apply_lease(evaluator.lease_date, evaluator.current_state, evaluator.future_state) }
|
|
108
|
-
after(:create) { |work, evaluator| 2.times { work.ordered_members <<
|
|
108
|
+
after(:create) { |work, evaluator| 2.times { work.ordered_members << FactoryBot.create(:file_set, user: evaluator.user) } }
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
end
|
|
@@ -113,6 +113,6 @@ FactoryGirl.define do
|
|
|
113
113
|
# Doesn't set up any edit_users
|
|
114
114
|
factory :work_without_access, class: GenericWork do
|
|
115
115
|
title ['Test title']
|
|
116
|
-
depositor {
|
|
116
|
+
depositor { FactoryBot.create(:user).user_key }
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
FactoryBot.define do
|
|
2
2
|
factory :permission_template, class: Hyrax::PermissionTemplate do
|
|
3
3
|
# Given that there is a one to one strong relation between permission_template and admin_set,
|
|
4
4
|
# with a unique index on the admin_set_id, I don't want to have duplication in admin_set_id
|
data/spec/factories/users.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
FactoryBot.define do
|
|
2
2
|
factory :user do
|
|
3
3
|
sequence(:email) { |n| "user#{n}@example.com" }
|
|
4
4
|
password 'password'
|
|
5
5
|
|
|
6
6
|
transient do
|
|
7
7
|
# Allow for custom groups when a user is instantiated.
|
|
8
|
-
# @example
|
|
8
|
+
# @example FactoryBot.create(:user, groups: 'avacado')
|
|
9
9
|
groups []
|
|
10
10
|
end
|
|
11
11
|
|
data/spec/factories/workflows.rb
CHANGED
|
@@ -17,6 +17,111 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
|
|
|
17
17
|
expect(form.workflow_id).to eq(workflow.id)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
describe 'integration tests' do
|
|
21
|
+
let(:permission_template) { create(:permission_template, with_admin_set: true, with_workflows: true) }
|
|
22
|
+
|
|
23
|
+
subject do
|
|
24
|
+
form.update(
|
|
25
|
+
ActionController::Parameters.new(
|
|
26
|
+
access_grants_attributes: [
|
|
27
|
+
ActionController::Parameters.new(agent_type: "user",
|
|
28
|
+
agent_id: user.user_key,
|
|
29
|
+
access: access_level).permit!
|
|
30
|
+
]
|
|
31
|
+
).permit!
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
before do
|
|
36
|
+
# Create MANAGING role manually
|
|
37
|
+
Sipity::Role[Hyrax::RoleRegistry::MANAGING]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def count_template_accesses_for(user, access_level)
|
|
41
|
+
Hyrax::PermissionTemplateAccess.where(
|
|
42
|
+
agent_id: user.user_key,
|
|
43
|
+
access: access_level
|
|
44
|
+
).count
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def count_workflow_responsibilities_for(user)
|
|
48
|
+
Sipity::WorkflowResponsibility.where(agent: user.to_sipity_agent).count
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'starts with no PTAs' do
|
|
52
|
+
expect(permission_template.access_grants).to be_empty
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context 'with manager users' do
|
|
56
|
+
let(:user) { create(:user) }
|
|
57
|
+
let(:access_level) { 'manage' }
|
|
58
|
+
|
|
59
|
+
it 'adds the expected permission template accesses and workflow responsibilities' do
|
|
60
|
+
expect { subject }.to change {
|
|
61
|
+
count_template_accesses_for(user, access_level)
|
|
62
|
+
}.from(0).to(1).and change {
|
|
63
|
+
count_workflow_responsibilities_for(user)
|
|
64
|
+
}.from(0).to(6)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'removes workflow responsibilities' do
|
|
68
|
+
subject
|
|
69
|
+
expect do
|
|
70
|
+
form.remove_access!(
|
|
71
|
+
permission_template.access_grants.find_by(agent_id: user.user_key, access: access_level)
|
|
72
|
+
)
|
|
73
|
+
end.to change { count_workflow_responsibilities_for(user) }
|
|
74
|
+
.from(6).to(0)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'with depositor users' do
|
|
79
|
+
let(:user) { create(:user) }
|
|
80
|
+
let(:access_level) { 'deposit' }
|
|
81
|
+
|
|
82
|
+
it 'adds the expected permission template accesses and workflow responsibilities' do
|
|
83
|
+
expect { subject }.to change {
|
|
84
|
+
count_template_accesses_for(user, access_level)
|
|
85
|
+
}.from(0).to(1).and change {
|
|
86
|
+
count_workflow_responsibilities_for(user)
|
|
87
|
+
}.from(0).to(2)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'removes workflow responsibilities' do
|
|
91
|
+
subject
|
|
92
|
+
expect do
|
|
93
|
+
form.remove_access!(
|
|
94
|
+
permission_template.access_grants.find_by(agent_id: user.user_key, access: access_level)
|
|
95
|
+
)
|
|
96
|
+
end.to change { count_workflow_responsibilities_for(user) }
|
|
97
|
+
.from(2).to(0)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
context 'with viewer users' do
|
|
102
|
+
let(:user) { create(:user) }
|
|
103
|
+
let(:access_level) { 'view' }
|
|
104
|
+
|
|
105
|
+
it 'adds the expected permission template accesses and workflow responsibilities' do
|
|
106
|
+
expect { subject }.to change {
|
|
107
|
+
count_template_accesses_for(user, access_level)
|
|
108
|
+
}.from(0).to(1).and change {
|
|
109
|
+
count_workflow_responsibilities_for(user)
|
|
110
|
+
}.by(0)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'does nothing (yet)' do
|
|
114
|
+
subject
|
|
115
|
+
expect do
|
|
116
|
+
form.remove_access!(
|
|
117
|
+
permission_template.access_grants.find_by(agent_id: user.user_key, access: access_level)
|
|
118
|
+
)
|
|
119
|
+
end.to change { count_workflow_responsibilities_for(user) }
|
|
120
|
+
.by(0)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
20
125
|
describe "#update" do
|
|
21
126
|
subject { form.update(input_params) }
|
|
22
127
|
|
|
@@ -234,7 +339,10 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
|
|
|
234
339
|
end
|
|
235
340
|
|
|
236
341
|
describe "#grant_workflow_roles" do
|
|
237
|
-
subject
|
|
342
|
+
subject do
|
|
343
|
+
form.attributes = attributes
|
|
344
|
+
form.send(:grant_workflow_roles)
|
|
345
|
+
end
|
|
238
346
|
|
|
239
347
|
let(:attributes) { { workflow_id: workflow.id } }
|
|
240
348
|
let(:workflow) { create(:workflow, permission_template: permission_template, active: true) }
|
|
@@ -428,7 +536,10 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
|
|
|
428
536
|
describe "#permission_template_update_params" do
|
|
429
537
|
let(:permission_template) { create(:permission_template, admin_set_id: admin_set.id) }
|
|
430
538
|
|
|
431
|
-
subject
|
|
539
|
+
subject do
|
|
540
|
+
form.attributes = input_params
|
|
541
|
+
form.send(:permission_template_update_params)
|
|
542
|
+
end
|
|
432
543
|
|
|
433
544
|
context "with release varies by date selected" do
|
|
434
545
|
let(:input_params) do
|