hyrax 2.1.0.beta2 → 2.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODE_OF_CONDUCT.md +5 -5
- data/.github/CONTRIBUTING.md +2 -2
- data/.rubocop.yml +1 -0
- data/.rubocop_fixme.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +3 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -0
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +4 -3
- data/app/actors/hyrax/actors/default_admin_set_actor.rb +9 -6
- data/app/assets/javascripts/hyrax.js +3 -0
- data/app/assets/javascripts/hyrax/app.js.erb +14 -0
- data/app/assets/javascripts/hyrax/batch_edit.js +2 -1
- data/app/assets/javascripts/hyrax/collection_types.es6 +97 -36
- data/app/assets/javascripts/hyrax/collections.js +15 -49
- data/app/assets/javascripts/hyrax/collections_utils.es6 +116 -0
- data/app/assets/javascripts/hyrax/collections_v2.es6 +57 -0
- data/app/assets/javascripts/hyrax/content_blocks.js +1 -13
- data/app/assets/javascripts/hyrax/nav_safety.js +41 -0
- data/app/assets/javascripts/hyrax/turbolinks_events.js +3 -0
- data/app/assets/stylesheets/hyrax/_collection_types.scss +46 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +6 -9
- data/app/assets/stylesheets/hyrax/dashboard.scss +2 -0
- data/app/assets/stylesheets/hyrax/sidebar.scss +4 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +10 -2
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -9
- data/app/controllers/hyrax/admin/collection_types_controller.rb +1 -1
- data/app/controllers/hyrax/batch_edits_controller.rb +30 -4
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +1 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/downloads_controller.rb +7 -1
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
- data/app/indexers/hyrax/repository_reindexer.rb +1 -1
- data/app/jobs/attach_files_to_work_job.rb +8 -4
- data/app/jobs/import_url_job.rb +11 -5
- data/app/models/admin_set.rb +25 -3
- data/app/models/concerns/hyrax/collection_behavior.rb +23 -11
- data/app/models/concerns/hyrax/collection_nesting.rb +22 -3
- data/app/models/hyrax/permission_template_access.rb +7 -4
- data/app/presenters/hyrax/admin_set_presenter.rb +21 -0
- data/app/presenters/hyrax/collection_presenter.rb +23 -1
- data/app/presenters/hyrax/dashboard/user_presenter.rb +4 -0
- data/app/presenters/hyrax/presents_attributes.rb +6 -2
- data/app/presenters/hyrax/work_show_presenter.rb +4 -0
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +14 -0
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +19 -39
- data/app/services/hyrax/admin_set_create_service.rb +1 -1
- data/app/services/hyrax/collection_types/create_service.rb +4 -0
- data/app/services/hyrax/collections/migration_service.rb +25 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +8 -3
- data/app/services/hyrax/collections/nested_collection_query_service.rb +3 -3
- data/app/services/hyrax/default_middleware_stack.rb +3 -3
- data/app/services/hyrax/multiple_membership_checker.rb +4 -2
- data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +0 -4
- data/app/views/hyrax/admin/admin_sets/_show_actions.html.erb +27 -0
- data/app/views/hyrax/admin/admin_sets/show.html.erb +1 -25
- data/app/views/hyrax/admin/collection_types/_form.html.erb +17 -6
- data/app/views/hyrax/admin/collection_types/_form_appearance.html.erb +5 -0
- data/app/views/hyrax/admin/collection_types/_form_participant_table.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/_form_participants.html.erb +56 -52
- data/app/views/hyrax/admin/collection_types/edit.html.erb +9 -7
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +15 -14
- data/app/views/hyrax/base/_form.html.erb +1 -0
- data/app/views/hyrax/base/_form_collections_error.html.erb +1 -0
- data/app/views/hyrax/base/_items.html.erb +3 -2
- data/app/views/hyrax/base/_metadata.html.erb +5 -7
- data/app/views/hyrax/base/_relationships.html.erb +3 -5
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +4 -5
- data/app/views/hyrax/base/_relationships_parent_rows.html.erb +2 -1
- data/app/views/hyrax/base/_show_actions.html.erb +11 -1
- data/app/views/hyrax/batch_edits/edit.html.erb +57 -17
- data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/content_blocks/_form.html.erb +8 -7
- data/app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb +17 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -3
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +30 -0
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +13 -2
- data/app/views/hyrax/dashboard/show_user.html.erb +10 -9
- data/app/views/hyrax/my/collections/_list_collections.html.erb +10 -3
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_delete_collections_deny.html.erb +14 -0
- data/app/views/hyrax/my/collections/index.html.erb +1 -0
- data/app/views/shared/_nav_safety_modal.html.erb +12 -0
- data/config/features.rb +4 -0
- data/config/initializers/samvera-nesting_indexer_initializer.rb +1 -0
- data/config/locales/hyrax.de.yml +26 -11
- data/config/locales/hyrax.en.yml +21 -6
- data/config/locales/hyrax.es.yml +17 -2
- data/config/locales/hyrax.fr.yml +17 -2
- data/config/locales/hyrax.it.yml +17 -2
- data/config/locales/hyrax.pt-BR.yml +17 -2
- data/config/locales/hyrax.zh.yml +17 -2
- data/config/locales/simple_form.en.yml +6 -27
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/assets_generator.rb +4 -0
- data/lib/generators/hyrax/install_generator.rb +10 -0
- data/lib/generators/hyrax/templates/app/assets/images/unauthorized.png +0 -0
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +6 -5
- data/lib/generators/hyrax/templates/config/tinymce.yml +12 -7
- data/lib/generators/hyrax/templates/db/migrate/20180406202557_add_badge_color_to_collection_types.rb.erb +5 -0
- data/lib/hyrax/configuration.rb +1 -1
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +24 -0
- data/spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb +19 -1
- data/spec/actors/hyrax/actors/default_admin_set_actor_spec.rb +41 -8
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +4 -12
- data/spec/actors/hyrax/actors/generic_work_actor_spec.rb +3 -7
- data/spec/controllers/hyrax/admin/strategies_controller_spec.rb +13 -2
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +83 -8
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +3 -0
- data/spec/controllers/hyrax/downloads_controller_spec.rb +26 -5
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +3 -6
- data/spec/controllers/hyrax/generic_works_controller_json_spec.rb +4 -4
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +3 -23
- data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
- data/spec/factories/admin_sets_lw.rb +215 -0
- data/spec/factories/collections.rb +10 -10
- data/spec/factory_tests/adminsets_factory_spec.rb +132 -0
- data/spec/factory_tests/collections_factory_spec.rb +3 -3
- data/spec/features/batch_create_spec.rb +5 -8
- data/spec/features/batch_edit_spec.rb +49 -2
- data/spec/features/collection_multi_membership_spec.rb +29 -14
- data/spec/features/collection_type_spec.rb +9 -2
- data/spec/features/create_work_admin_spec.rb +1 -1
- data/spec/features/create_work_spec.rb +1 -1
- data/spec/features/dashboard/collection_spec.rb +16 -12
- data/spec/features/edit_content_block_admin_spec.rb +29 -12
- data/spec/features/embargo_spec.rb +55 -0
- data/spec/features/proxy_spec.rb +3 -1
- data/spec/features/work_show_spec.rb +20 -4
- data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
- data/spec/indexers/hyrax/repository_reindexer_spec.rb +1 -1
- data/spec/jobs/attach_files_to_work_job_spec.rb +15 -3
- data/spec/jobs/batch_create_job_spec.rb +6 -6
- data/spec/jobs/create_work_job_spec.rb +1 -1
- data/spec/models/admin_set_spec.rb +10 -8
- data/spec/models/collection_spec.rb +1 -1
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +6 -3
- data/spec/models/flipflop_spec.rb +8 -0
- data/spec/models/hyrax/work_behavior_spec.rb +1 -1
- data/spec/presenters/hyrax/admin_set_presenter_spec.rb +70 -0
- data/spec/presenters/hyrax/collection_presenter_spec.rb +66 -0
- data/spec/renderers/hyrax/renderers/attribute_renderer_spec.rb +19 -0
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +31 -21
- data/spec/services/hyrax/collection_types/create_service_spec.rb +7 -4
- data/spec/services/hyrax/collections/migration_service_spec.rb +204 -17
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_create_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_service_spec.rb +4 -0
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -1
- data/spec/services/hyrax/multiple_membership_checker_spec.rb +4 -4
- data/spec/services/hyrax/workflow/grant_edit_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/grant_read_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/revoke_edit_from_depositor_spec.rb +1 -1
- data/spec/spec_helper.rb +35 -2
- data/spec/support/features/batch_edit_actions.rb +1 -1
- data/spec/support/selectors.rb +15 -0
- data/spec/views/hyrax/admin/admin_sets/_show_actions.html.erb_spec.rb +66 -0
- data/spec/views/hyrax/admin/admin_sets/show.html.erb_spec.rb +5 -34
- data/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb +3 -1
- data/spec/views/hyrax/admin/collection_types/_form_appearance.html.erb_spec.rb +22 -0
- data/spec/views/hyrax/admin/collection_types/_form_participants.html.erb_spec.rb +11 -3
- data/spec/views/hyrax/base/_items.html.erb_spec.rb +46 -0
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +4 -2
- data/spec/views/hyrax/dashboard/collections/_default_group.html.erb_spec.rb +43 -0
- data/spec/views/hyrax/dashboard/collections/_list_collections.html.erb_spec.rb +51 -0
- data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/dashboard/show_user_spec.rb +5 -2
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +2 -0
- data/template.rb +1 -1
- metadata +30 -13
- data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +0 -15
@@ -24,7 +24,7 @@ RSpec.describe Hyrax::Collections::PermissionsCreateService do
|
|
24
24
|
end
|
25
25
|
let!(:collection_type_participant) { create(:collection_type_participant, user_manage_attributes) }
|
26
26
|
let!(:collection_type_participant2) { create(:collection_type_participant, group_manage_attributes) }
|
27
|
-
let(:collection) {
|
27
|
+
let(:collection) { build(:collection_lw, id: 'collection1', collection_type_gid: collection_type.gid) }
|
28
28
|
|
29
29
|
before do
|
30
30
|
subject
|
@@ -187,6 +187,10 @@ RSpec.describe Hyrax::Collections::PermissionsService do
|
|
187
187
|
it 'returns admin set ids where user has deposit access' do
|
188
188
|
expect(described_class.source_ids_for_deposit(ability: ability, source_type: 'admin_set')).to match_array [as_du.id, as_dg.id, as_mu.id, as_mg.id]
|
189
189
|
end
|
190
|
+
it 'returns admin set ids where user has deposit access except excluded groups' do
|
191
|
+
expect(described_class.source_ids_for_deposit(ability: ability, source_type: 'admin_set', exclude_groups: ['deposit_group']))
|
192
|
+
.to match_array [as_du.id, as_mu.id, as_mg.id]
|
193
|
+
end
|
190
194
|
|
191
195
|
context 'when user has no access' do
|
192
196
|
let(:ability) { Ability.new(user2) }
|
@@ -15,9 +15,9 @@ RSpec.describe Hyrax::DefaultMiddlewareStack do
|
|
15
15
|
Hyrax::Actors::AddToWorkActor,
|
16
16
|
Hyrax::Actors::AttachMembersActor,
|
17
17
|
Hyrax::Actors::ApplyOrderActor,
|
18
|
+
Hyrax::Actors::DefaultAdminSetActor,
|
18
19
|
Hyrax::Actors::InterpretVisibilityActor,
|
19
20
|
Hyrax::Actors::TransferRequestActor,
|
20
|
-
Hyrax::Actors::DefaultAdminSetActor,
|
21
21
|
Hyrax::Actors::ApplyPermissionTemplateActor,
|
22
22
|
Hyrax::Actors::CleanupFileSetsActor,
|
23
23
|
Hyrax::Actors::CleanupTrophiesActor,
|
@@ -73,7 +73,7 @@ RSpec.describe Hyrax::MultipleMembershipChecker, :clean_repo do
|
|
73
73
|
expect(item).not_to receive(:member_of_collection_ids)
|
74
74
|
expect(checker).to receive(:single_membership_collections).with(collection_ids).once.and_call_original
|
75
75
|
expect(Collection).to receive(:where).with(id: collection_ids, collection_type_gid_ssim: [collection_type.gid]).once.and_return(collections)
|
76
|
-
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection
|
76
|
+
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection type (type: Greedy, collections: Foo and Bar)'
|
77
77
|
end
|
78
78
|
|
79
79
|
context 'with multiple single membership collection types' do
|
@@ -84,7 +84,7 @@ RSpec.describe Hyrax::MultipleMembershipChecker, :clean_repo do
|
|
84
84
|
expect(item).not_to receive(:member_of_collection_ids)
|
85
85
|
expect(checker).to receive(:single_membership_collections).with(collection_ids).once.and_call_original
|
86
86
|
expect(Collection).to receive(:where).with(id: collection_ids, collection_type_gid_ssim: collection_types).once.and_return(collections)
|
87
|
-
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection
|
87
|
+
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection type (type: Greedy, collections: Foo and Bar)'
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -104,7 +104,7 @@ RSpec.describe Hyrax::MultipleMembershipChecker, :clean_repo do
|
|
104
104
|
expect(item).to receive(:member_of_collection_ids)
|
105
105
|
expect(Collection).to receive(:where).with(id: collection_ids, collection_type_gid_ssim: [collection_type.gid]).once.and_return(collections)
|
106
106
|
expect(Collection).to receive(:where).with(id: [collection2.id], collection_type_gid_ssim: [collection_type.gid]).once.and_return([collection2])
|
107
|
-
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection
|
107
|
+
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection type (type: Greedy, collections: Foo and Bar)'
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'with multiple single membership collection types' do
|
@@ -115,7 +115,7 @@ RSpec.describe Hyrax::MultipleMembershipChecker, :clean_repo do
|
|
115
115
|
expect(item).to receive(:member_of_collection_ids)
|
116
116
|
expect(Collection).to receive(:where).with(id: collection_ids, collection_type_gid_ssim: collection_types).once.and_return(collections)
|
117
117
|
expect(Collection).to receive(:where).with(id: [collection2.id], collection_type_gid_ssim: collection_types).once.and_return([collection2])
|
118
|
-
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection
|
118
|
+
expect(subject).to eq 'Error: You have specified more than one of the same single-membership collection type (type: Greedy, collections: Foo and Bar)'
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -34,7 +34,7 @@ RSpec.describe Hyrax::Workflow::GrantEditToDepositor do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context "with attached FileSets" do
|
37
|
+
context "with attached FileSets", :perform_enqueued do
|
38
38
|
let(:work) { create(:work_with_one_file, user: depositor) }
|
39
39
|
let(:file_set) do
|
40
40
|
work.members.first.tap do |file_set|
|
@@ -34,7 +34,7 @@ RSpec.describe Hyrax::Workflow::GrantReadToDepositor do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context "with attached FileSets" do
|
37
|
+
context "with attached FileSets", perform_enqueued: [Hyrax::GrantReadToMembersJob] do
|
38
38
|
let(:work) { create(:work_with_one_file, user: depositor) }
|
39
39
|
let(:file_set) { work.members.first }
|
40
40
|
|
@@ -34,7 +34,7 @@ RSpec.describe Hyrax::Workflow::RevokeEditFromDepositor do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context "with attached FileSets" do
|
37
|
+
context "with attached FileSets", perform_enqueued: [Hyrax::RevokeEditFromMembersJob] do
|
38
38
|
let(:work) { create(:work_with_one_file, user: depositor) }
|
39
39
|
let(:file_set) { work.members.first }
|
40
40
|
|
data/spec/spec_helper.rb
CHANGED
@@ -78,7 +78,7 @@ end
|
|
78
78
|
Capybara.default_driver = :rack_test # This is a faster driver
|
79
79
|
Capybara.javascript_driver = :selenium_chrome_headless_sandboxless # This is slower
|
80
80
|
|
81
|
-
|
81
|
+
ActiveJob::Base.queue_adapter = :test
|
82
82
|
|
83
83
|
# require 'http_logger'
|
84
84
|
# HttpLogger.logger = Logger.new(STDOUT)
|
@@ -179,7 +179,7 @@ RSpec.configure do |config|
|
|
179
179
|
Hyrax.config.default_nested_relationship_reindexer
|
180
180
|
else
|
181
181
|
# Don't use the nested relationship reindexer. This slows everything down quite a bit.
|
182
|
-
->(id:) {}
|
182
|
+
->(id:, extent:) {}
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -246,4 +246,37 @@ RSpec.configure do |config|
|
|
246
246
|
config.example_status_persistence_file_path = 'spec/examples.txt'
|
247
247
|
|
248
248
|
config.profile_examples = 10
|
249
|
+
|
250
|
+
# Use this example metadata when you want to perform jobs inline during testing.
|
251
|
+
#
|
252
|
+
# describe '#my_method`, :perform_enqueued do
|
253
|
+
# ...
|
254
|
+
# end
|
255
|
+
#
|
256
|
+
# If you pass an `Array` of job classes, they will be treated as the filter list.
|
257
|
+
#
|
258
|
+
# describe '#my_method`, perform_enqueued: [MyJobClass] do
|
259
|
+
# ...
|
260
|
+
# end
|
261
|
+
#
|
262
|
+
# Limit to specific job classes with:
|
263
|
+
#
|
264
|
+
# ActiveJob::Base.queue_adapter.filter = [JobClass]
|
265
|
+
#
|
266
|
+
config.before(:example, :perform_enqueued) do |example|
|
267
|
+
ActiveJob::Base.queue_adapter.filter =
|
268
|
+
example.metadata[:perform_enqueued].try(:to_a)
|
269
|
+
|
270
|
+
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
|
271
|
+
ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = true
|
272
|
+
end
|
273
|
+
|
274
|
+
config.after(:example, :perform_enqueued) do
|
275
|
+
ActiveJob::Base.queue_adapter.filter = nil
|
276
|
+
ActiveJob::Base.queue_adapter.enqueued_jobs = []
|
277
|
+
ActiveJob::Base.queue_adapter.performed_jobs = []
|
278
|
+
|
279
|
+
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = false
|
280
|
+
ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = false
|
281
|
+
end
|
249
282
|
end
|
@@ -17,7 +17,7 @@ def fill_in_batch_edit_fields_and_verify!
|
|
17
17
|
# This was `expect(page).to have_content 'Changes Saved'`, however in debugging,
|
18
18
|
# the `have_content` check was ignoring the `within` scoping and finding
|
19
19
|
# "Changes Saved" for other field areas
|
20
|
-
find('.status', text: 'Changes Saved')
|
20
|
+
find('.status', text: 'Changes Saved', wait: 5)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/support/selectors.rb
CHANGED
@@ -20,6 +20,21 @@ module Selectors
|
|
20
20
|
find('input.edit-collection-add-sharing-button').click
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
# For use with javascript collection selector that allows for searching for an existing collection.
|
25
|
+
# @param [Collection] collection to select
|
26
|
+
def select_collection(collection)
|
27
|
+
first('a.select2-choice').click
|
28
|
+
find('.select2-input').set(collection.title.first)
|
29
|
+
expect(page).to have_css('div.select2-result-label')
|
30
|
+
first('div.select2-result-label').click
|
31
|
+
first('[data-behavior~=add-relationship]').click
|
32
|
+
within('[data-behavior~=collection-relationships]') do
|
33
|
+
within('table.table.table-striped') do
|
34
|
+
expect(page).to have_content(collection.title.first)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
23
38
|
end
|
24
39
|
|
25
40
|
module NewTransfers
|
@@ -0,0 +1,66 @@
|
|
1
|
+
RSpec.describe 'hyrax/admin/admin_sets/_show_actions.html.erb', type: :view do
|
2
|
+
let(:solr_document) { SolrDocument.new }
|
3
|
+
let(:ability) { instance_double("Ability") }
|
4
|
+
let(:presenter) { Hyrax::AdminSetPresenter.new(solr_document, ability) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
allow(controller).to receive(:current_ability).and_return(ability)
|
8
|
+
allow(view).to receive(:presenter).and_return(presenter)
|
9
|
+
|
10
|
+
# Stub route because view specs don't handle engine routes
|
11
|
+
allow(view).to receive(:edit_admin_admin_set_path).with(presenter).and_return("/admin/admin_sets/123/edit")
|
12
|
+
allow(view).to receive(:admin_admin_set_path).with(presenter).and_return("/admin/admin_sets/123")
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when editor of the admin_set' do
|
16
|
+
before do
|
17
|
+
allow(ability).to receive(:can?).with(:edit, solr_document).and_return(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
context "when presenter has delete disabled" do
|
21
|
+
before do
|
22
|
+
allow(presenter).to receive(:disable_delete?).and_return(true)
|
23
|
+
render
|
24
|
+
end
|
25
|
+
it "displays a disabled delete button" do
|
26
|
+
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
27
|
+
expect(rendered).to have_selector(:css, "a.btn-primary")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with empty admin set" do
|
32
|
+
before do
|
33
|
+
allow(presenter).to receive(:disable_delete?).and_return(false)
|
34
|
+
render
|
35
|
+
end
|
36
|
+
it "displays an enabled delete button" do
|
37
|
+
expect(rendered).to have_selector(:css, "a.btn-danger")
|
38
|
+
expect(rendered).not_to have_selector(:css, "a.btn-danger.disabled")
|
39
|
+
expect(rendered).to have_selector(:css, "a.btn-primary")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "with default admin set" do
|
44
|
+
before do
|
45
|
+
allow(presenter).to receive(:disable_delete?).and_return(true)
|
46
|
+
render
|
47
|
+
end
|
48
|
+
it "displays a disabled delete button" do
|
49
|
+
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
50
|
+
expect(rendered).to have_selector(:css, "a.btn-primary")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when reader of the admin_set' do
|
56
|
+
before do
|
57
|
+
allow(ability).to receive(:can?).with(:edit, solr_document).and_return(false)
|
58
|
+
render
|
59
|
+
end
|
60
|
+
|
61
|
+
it "doesn't display any action buttons" do
|
62
|
+
expect(rendered).not_to have_selector(:css, "a.btn-danger")
|
63
|
+
expect(rendered).not_to have_selector(:css, "a.btn-primary")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,50 +1,21 @@
|
|
1
1
|
RSpec.describe "hyrax/admin/admin_sets/show.html.erb", type: :view do
|
2
2
|
let(:solr_document) { SolrDocument.new }
|
3
|
-
let(:ability) {
|
3
|
+
let(:ability) { instance_double("Ability") }
|
4
4
|
let(:presenter) { Hyrax::AdminSetPresenter.new(solr_document, ability) }
|
5
5
|
|
6
6
|
before do
|
7
|
-
allow(presenter).to receive(:total_items).and_return(0)
|
8
|
-
# Stub route because view specs don't handle engine routes
|
9
|
-
allow(view).to receive(:edit_admin_admin_set_path).and_return("/admin/admin_sets/123/edit")
|
10
|
-
allow(view).to receive(:admin_admin_set_path).and_return("/admin/admin_sets/123")
|
11
|
-
|
12
7
|
stub_template '_collection_description.html.erb' => ''
|
8
|
+
stub_template '_show_actions.erb' => ''
|
13
9
|
stub_template '_show_descriptions.erb' => ''
|
14
10
|
stub_template '_sort_and_per_page.html.erb' => 'sort and per page'
|
15
11
|
stub_template '_document_list.html.erb' => 'document list'
|
16
12
|
stub_template '_paginate.html.erb' => 'paginate'
|
17
13
|
|
18
14
|
assign(:presenter, presenter)
|
15
|
+
render
|
19
16
|
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
allow(presenter).to receive(:disable_delete?).and_return(true)
|
24
|
-
render
|
25
|
-
end
|
26
|
-
it "displays a disabled delete button" do
|
27
|
-
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "with empty admin set" do
|
32
|
-
before do
|
33
|
-
render
|
34
|
-
end
|
35
|
-
it "displays an enabled delete button" do
|
36
|
-
expect(rendered).to have_selector(:css, "a.btn-danger")
|
37
|
-
expect(rendered).not_to have_selector(:css, "a.btn-danger.disabled")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "with default admin set" do
|
42
|
-
before do
|
43
|
-
allow(presenter).to receive(:disable_delete?).and_return(true)
|
44
|
-
render
|
45
|
-
end
|
46
|
-
it "displays a disabled delete button" do
|
47
|
-
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
48
|
-
end
|
18
|
+
it "displays a disabled delete button" do
|
19
|
+
expect(rendered).to have_selector('div.admin-set')
|
49
20
|
end
|
50
21
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
RSpec.describe 'hyrax/admin/collection_types/_form.html.erb', type: :view do
|
2
2
|
let(:collection_type) { build(:collection_type) }
|
3
|
-
# let(:collection_type) { build(:collection_type, machine_id: "type_does_not_matter") }
|
4
3
|
let(:form) { Hyrax::Forms::Admin::CollectionTypeForm.new(collection_type: collection_type) }
|
5
4
|
|
6
5
|
before do
|
@@ -13,6 +12,7 @@ RSpec.describe 'hyrax/admin/collection_types/_form.html.erb', type: :view do
|
|
13
12
|
expect(rendered).to have_selector('#metadata')
|
14
13
|
expect(rendered).to have_selector('#settings')
|
15
14
|
expect(rendered).to have_selector('#participants')
|
15
|
+
expect(rendered).to have_selector('#appearance')
|
16
16
|
end
|
17
17
|
|
18
18
|
context "when creating a new collection type" do
|
@@ -25,6 +25,7 @@ RSpec.describe 'hyrax/admin/collection_types/_form.html.erb', type: :view do
|
|
25
25
|
expect(rendered).to have_link(I18n.t('hyrax.admin.collection_types.form.tab.metadata'))
|
26
26
|
expect(rendered).not_to have_link(I18n.t('hyrax.admin.collection_types.form.tab.settings'))
|
27
27
|
expect(rendered).not_to have_link(I18n.t('hyrax.admin.collection_types.form.tab.participants'))
|
28
|
+
expect(rendered).not_to have_link(I18n.t('hyrax.admin.collection_types.form.tab.appearance'))
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -38,6 +39,7 @@ RSpec.describe 'hyrax/admin/collection_types/_form.html.erb', type: :view do
|
|
38
39
|
expect(rendered).to have_link(I18n.t('hyrax.admin.collection_types.form.tab.metadata'))
|
39
40
|
expect(rendered).to have_link(I18n.t('hyrax.admin.collection_types.form.tab.settings'))
|
40
41
|
expect(rendered).to have_link(I18n.t('hyrax.admin.collection_types.form.tab.participants'))
|
42
|
+
expect(rendered).to have_link(I18n.t('hyrax.admin.collection_types.form.tab.appearance'))
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
RSpec.describe 'hyrax/admin/collection_types/_form_appearance.html.erb', type: :view do
|
2
|
+
let(:collection_type) { create(:collection_type) }
|
3
|
+
let(:collection_type_form) { Hyrax::Forms::Admin::CollectionTypeForm.new }
|
4
|
+
|
5
|
+
let(:form) do
|
6
|
+
view.simple_form_for(collection_type, url: '/update') do |fs_form|
|
7
|
+
return fs_form
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
before do
|
12
|
+
assign(:form, collection_type_form)
|
13
|
+
allow(view).to receive(:f).and_return(form)
|
14
|
+
render
|
15
|
+
end
|
16
|
+
|
17
|
+
# This needs a little more work.
|
18
|
+
it "renders the badge color options" do
|
19
|
+
expect(rendered).to have_content(I18n.t("simple_form.labels.collection_type.badge_color"))
|
20
|
+
expect(rendered).to have_selector("input#collection_type_badge_color")
|
21
|
+
end
|
22
|
+
end
|
@@ -9,8 +9,16 @@ RSpec.describe 'hyrax/admin/collection_types/_form_participants.html.erb', type:
|
|
9
9
|
assign(:form, form)
|
10
10
|
render
|
11
11
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
context 'Collection Types edit participants tab' do
|
14
|
+
it 'has the required form selectors' do
|
15
|
+
expect(rendered).to have_selector('#user-participants-form')
|
16
|
+
expect(rendered).to have_selector('#group-participants-form')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has the required javascript selectors to process AJAX add user and add group requests' do
|
20
|
+
expect(rendered).to have_selector('.form-add-participants-wrapper')
|
21
|
+
expect(rendered).to have_selector('.add-participants-form')
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
@@ -32,4 +32,50 @@ RSpec.describe 'hyrax/base/_items.html.erb', type: :view do
|
|
32
32
|
expect(rendered).to have_css('tbody', text: member_presenters.join)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
context "when file set members are present" do
|
37
|
+
let(:user) { create(:user) }
|
38
|
+
let(:ability) { Ability.new(user) }
|
39
|
+
let(:file1) { create(:file_set, :public) }
|
40
|
+
let(:file2) { create(:file_set) }
|
41
|
+
|
42
|
+
let(:solr_document) { SolrDocument.new(attributes) }
|
43
|
+
let(:presenter) { Hyrax::WorkShowPresenter.new(solr_document, ability, request) }
|
44
|
+
|
45
|
+
before do
|
46
|
+
stub_template 'hyrax/base/_member.html.erb' => '<%= member %>'
|
47
|
+
end
|
48
|
+
|
49
|
+
context "and a public file set" do
|
50
|
+
let(:attributes) { create(:public_work, ordered_members: [file1]).to_solr }
|
51
|
+
|
52
|
+
it "show the link for the file set" do
|
53
|
+
expect(Flipflop).to receive(:hide_private_files?).and_return(true)
|
54
|
+
render 'hyrax/base/items', presenter: presenter
|
55
|
+
expect(rendered).to have_content presenter.member_presenters.first.link_name
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "and a private file set" do
|
60
|
+
let(:attributes) { create(:public_work, ordered_members: [file2]).to_solr }
|
61
|
+
|
62
|
+
it "won't show the link to the file set" do
|
63
|
+
expect(Flipflop).to receive(:hide_private_files?).and_return(true)
|
64
|
+
expect(view).to receive(:can?).with(:edit, presenter.id).and_return(false)
|
65
|
+
render 'hyrax/base/items', presenter: presenter
|
66
|
+
expect(rendered).not_to have_content presenter.member_presenters.first.link_name
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "with public and private file sets" do
|
71
|
+
let(:attributes) { create(:public_work, ordered_members: [file1, file2]).to_solr }
|
72
|
+
|
73
|
+
it "only show the link to the file set that users have permission to see" do
|
74
|
+
expect(Flipflop).to receive(:hide_private_files?).and_return(true)
|
75
|
+
render 'hyrax/base/items', presenter: presenter
|
76
|
+
expect(rendered).to have_content presenter.member_presenters.first.link_name
|
77
|
+
expect(rendered).not_to have_content presenter.member_presenters[1].link_name
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
35
81
|
end
|