hyrax 3.0.0.pre.beta1 → 3.0.0.pre.beta2
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 +5 -5
- data/.circleci/config.yml +157 -68
- data/.travis.yml +4 -1
- data/Gemfile +1 -0
- data/README.md +3 -3
- data/app/actors/hyrax/actors/collections_membership_actor.rb +5 -55
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +6 -8
- data/app/actors/hyrax/actors/environment.rb +15 -0
- data/app/actors/hyrax/actors/interpret_visibility_actor.rb +22 -37
- data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +1 -1
- data/app/assets/stylesheets/hyrax/_collections.scss +5 -3
- data/app/assets/stylesheets/hyrax/dashboard.scss +3 -3
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +21 -2
- data/app/controllers/hyrax/homepage_controller.rb +1 -1
- data/app/forms/hyrax/forms/work_form.rb +1 -1
- data/app/helpers/hyrax/collections_helper.rb +13 -0
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +3 -3
- data/app/indexers/hyrax/admin_set_indexer.rb +1 -1
- data/app/indexers/hyrax/basic_metadata_indexer.rb +1 -1
- data/app/indexers/hyrax/collection_indexer.rb +3 -3
- data/app/indexers/hyrax/deep_indexing_service.rb +12 -12
- data/app/indexers/hyrax/file_set_indexer.rb +1 -1
- data/app/indexers/hyrax/indexes_workflow.rb +4 -4
- data/app/indexers/hyrax/work_indexer.rb +1 -1
- data/app/models/concerns/hyrax/basic_metadata.rb +2 -0
- data/app/models/concerns/hyrax/collection_behavior.rb +3 -3
- data/app/models/concerns/hyrax/file_set/querying.rb +1 -1
- data/app/models/concerns/hyrax/human_readable_type.rb +2 -2
- data/app/models/concerns/hyrax/solr_document/characterization.rb +23 -23
- data/app/models/concerns/hyrax/solr_document/metadata.rb +3 -2
- data/app/models/concerns/hyrax/solr_document_behavior.rb +3 -3
- data/app/models/concerns/hyrax/user.rb +10 -2
- data/app/presenters/hyrax/work_show_presenter.rb +2 -2
- data/app/renderers/hyrax/renderers/faceted_attribute_renderer.rb +1 -1
- data/app/search_builders/hyrax/collection_search_builder.rb +1 -1
- data/app/search_builders/hyrax/deposit_search_builder.rb +1 -1
- data/app/search_builders/hyrax/embargo_search_builder.rb +1 -1
- data/app/search_builders/hyrax/lease_search_builder.rb +1 -1
- data/app/services/hyrax/default_middleware_stack.rb +0 -4
- data/app/services/hyrax/statistics/file_sets/by_format.rb +1 -1
- data/app/services/hyrax/statistics/works/by_resource_type.rb +1 -1
- data/app/services/hyrax/visibility_intention.rb +78 -0
- data/app/views/catalog/_index_list_default.html.erb +3 -3
- data/app/views/catalog/_thumbnail_list_collection.html.erb +3 -2
- data/app/views/hyrax/base/_attribute_rows.html.erb +1 -0
- data/app/views/hyrax/base/_form_files.html.erb +2 -2
- data/app/views/hyrax/base/_form_visibility_component.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +6 -6
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_edits/_check_all.html.erb +1 -1
- data/app/views/hyrax/batch_edits/_delete_selected.html.erb +1 -1
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +4 -4
- data/app/views/records/show_fields/_based_near.html.erb +1 -1
- data/app/views/records/show_fields/_creator.html.erb +1 -1
- data/app/views/records/show_fields/_keyword.html.erb +1 -1
- data/app/views/records/show_fields/_language.html.erb +1 -1
- data/app/views/records/show_fields/_publisher.html.erb +1 -1
- data/app/views/records/show_fields/_resource_type.html.erb +1 -1
- data/app/views/records/show_fields/_subject.html.erb +1 -1
- data/config/initializers/samvera-nesting_indexer_initializer.rb +3 -3
- data/config/locales/hyrax.de.yml +35 -22
- data/config/locales/hyrax.en.yml +22 -2
- data/config/locales/hyrax.es.yml +21 -1
- data/config/locales/hyrax.fr.yml +21 -1
- data/config/locales/hyrax.it.yml +21 -1
- data/config/locales/hyrax.pt-BR.yml +21 -1
- data/config/locales/hyrax.zh.yml +21 -1
- data/hyrax.gemspec +7 -9
- data/lib/generators/hyrax/templates/catalog_controller.rb +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +10 -10
- data/lib/generators/hyrax/work/templates/locale.pt-BR.yml.erb +1 -1
- data/lib/hyrax/configuration.rb +18 -0
- data/lib/hyrax/engine.rb +8 -0
- data/lib/hyrax/transactions/container.rb +6 -0
- data/lib/hyrax/transactions/destroy_work.rb +21 -0
- data/lib/hyrax/transactions/steps/destroy_work.rb +24 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings.rb +45 -0
- data/lib/wings/active_fedora_converter.rb +56 -0
- data/lib/wings/model_transformer.rb +158 -0
- data/lib/wings/resource_factory.rb +8 -0
- data/lib/wings/valkyrie/metadata_adapter.rb +29 -0
- data/lib/wings/valkyrie/persister.rb +50 -0
- data/lib/wings/valkyrie/query_service.rb +43 -0
- data/lib/wings/valkyrie/resource_factory.rb +45 -0
- data/lib/wings/valkyrizable.rb +24 -0
- data/lib/wings/value_mapper.rb +59 -0
- data/spec/abilities/collection_ability_spec.rb +5 -5
- data/spec/abilities/permission_template_ability_spec.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +6 -175
- data/spec/actors/hyrax/actors/create_with_remote_files_ordered_members_actor_spec.rb +30 -22
- data/spec/actors/hyrax/actors/interpret_visibility_actor_spec.rb +2 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/collections_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb +16 -13
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +10 -1
- data/spec/controllers/hyrax/homepage_controller_spec.rb +3 -3
- data/spec/controllers/hyrax/my/shares_controller_spec.rb +1 -1
- data/spec/features/actor_stack_spec.rb +48 -0
- data/spec/features/catalog_search_spec.rb +2 -2
- data/spec/features/collection_multi_membership_spec.rb +2 -2
- data/spec/features/collection_spec.rb +7 -7
- data/spec/features/collection_type_spec.rb +2 -2
- data/spec/features/dashboard/collection_spec.rb +18 -18
- data/spec/features/delete_work_spec.rb +1 -1
- data/spec/features/search_spec.rb +2 -2
- data/spec/features/work_show_spec.rb +5 -2
- data/spec/forms/hyrax/forms/batch_upload_form_spec.rb +1 -0
- data/spec/forms/hyrax/forms/collection_form_spec.rb +5 -5
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +1 -1
- data/spec/forms/hyrax/forms/work_form_spec.rb +2 -0
- data/spec/helpers/blacklight_helper_spec.rb +3 -1
- data/spec/helpers/hyrax/collections_helper_spec.rb +42 -0
- data/spec/helpers/hyrax/dashboard_helper_behavior_spec.rb +4 -4
- data/spec/helpers/hyrax_helper_spec.rb +8 -4
- data/spec/hyrax/transactions/destroy_work_spec.rb +35 -0
- data/spec/hyrax/transactions/steps/destroy_work_spec.rb +33 -0
- data/spec/indexers/hyrax/collection_indexer_spec.rb +1 -1
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/lib/hyrax/resource_sync/change_list_writer_spec.rb +35 -21
- data/spec/lib/hyrax/resource_sync/resource_list_writer_spec.rb +1 -1
- data/spec/models/collection_spec.rb +18 -18
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +2 -2
- data/spec/models/file_set_spec.rb +2 -2
- data/spec/models/hyrax/collection_type_spec.rb +2 -2
- data/spec/models/user_spec.rb +26 -1
- data/spec/presenters/hyrax/collection_presenter_spec.rb +11 -11
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +11 -0
- data/spec/search_builders/hyrax/collection_member_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/collection_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/work_relation_spec.rb +1 -1
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +2 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +2 -2
- data/spec/services/hyrax/collections/migration_service_spec.rb +27 -27
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/nested_collection_query_service_spec.rb +38 -38
- data/spec/services/hyrax/curation_concern_spec.rb +1 -1
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -2
- data/spec/services/hyrax/statistics/depositors/summary_spec.rb +1 -1
- data/spec/services/hyrax/statistics/works/by_resource_type_spec.rb +11 -4
- data/spec/services/hyrax/visibility_intention_spec.rb +144 -0
- data/spec/services/hyrax/workflow/changes_required_notification_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- data/spec/support/selectors.rb +10 -1
- data/spec/test_app_templates/Gemfile.extra +2 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +6 -0
- data/spec/views/catalog/_index_list_default.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb +38 -5
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +9 -9
- data/spec/views/hyrax/base/show.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/wings/active_fedora_converter_spec.rb +31 -0
- data/spec/wings/model_transformer_spec.rb +288 -0
- data/spec/wings/valkyrie/metadata_adapter_spec.rb +10 -0
- data/spec/wings/valkyrie/persister_spec.rb +71 -0
- data/spec/wings/valkyrie/query_service_spec.rb +81 -0
- data/spec/wings/valkyrie/resource_factory_spec.rb +32 -0
- data/spec/wings/value_mapper_spec.rb +60 -0
- data/spec/wings_spec.rb +8 -0
- data/template.rb +3 -1
- metadata +86 -36
|
@@ -292,7 +292,7 @@ RSpec.describe 'collection_type', type: :feature, clean_repo: true do
|
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
context 'when collections exist of this type' do
|
|
295
|
-
let!(:collection1) { create(:
|
|
295
|
+
let!(:collection1) { create(:public_collection_lw, user: build(:user), collection_type_gid: exhibit_collection_type.gid) }
|
|
296
296
|
|
|
297
297
|
before do
|
|
298
298
|
exhibit_collection_type
|
|
@@ -352,7 +352,7 @@ RSpec.describe 'collection_type', type: :feature, clean_repo: true do
|
|
|
352
352
|
|
|
353
353
|
context 'when collections exist of this type' do
|
|
354
354
|
let!(:not_empty_collection_type) { create(:collection_type, title: 'Not Empty Type', creator_user: admin_user) }
|
|
355
|
-
let!(:collection1) { create(:
|
|
355
|
+
let!(:collection1) { create(:public_collection_lw, user: admin_user, collection_type_gid: not_empty_collection_type.gid) }
|
|
356
356
|
let(:deny_delete_modal_text) do
|
|
357
357
|
'You cannot delete this collection type because one or more collections of this type have already been created. ' \
|
|
358
358
|
'To delete this collection type, first ensure that all collections of this type have been deleted.'
|
|
@@ -11,10 +11,10 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
11
11
|
# Setting Title on admin sets to avoid false positive matches with collections.
|
|
12
12
|
let(:admin_set_a) { create(:admin_set, creator: [admin_user.user_key], title: ['Set A'], with_permission_template: true) }
|
|
13
13
|
let(:admin_set_b) { create(:admin_set, creator: [user.user_key], title: ['Set B'], edit_users: [user.user_key], with_permission_template: true) }
|
|
14
|
-
let(:collection1) { create(:
|
|
15
|
-
let(:collection2) { create(:
|
|
16
|
-
let(:collection3) { create(:
|
|
17
|
-
let(:collection4) { create(:
|
|
14
|
+
let(:collection1) { create(:public_collection_lw, user: user, collection_type_gid: collection_type.gid, with_permission_template: true) }
|
|
15
|
+
let(:collection2) { create(:public_collection_lw, user: user, collection_type_gid: collection_type.gid, with_permission_template: true) }
|
|
16
|
+
let(:collection3) { create(:public_collection_lw, user: admin_user, collection_type_gid: collection_type.gid, with_permission_template: true) }
|
|
17
|
+
let(:collection4) { create(:public_collection_lw, user: admin_user, collection_type_gid: user_collection_type.gid, with_permission_template: true) }
|
|
18
18
|
|
|
19
19
|
describe 'Your Collections tab' do
|
|
20
20
|
context 'when non-admin user' do
|
|
@@ -250,7 +250,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
250
250
|
expect(page).to have_selector "input.collection_creator.multi_value"
|
|
251
251
|
|
|
252
252
|
fill_in('Title', with: title)
|
|
253
|
-
fill_in('
|
|
253
|
+
fill_in('Description', with: description)
|
|
254
254
|
fill_in('Related URL', with: 'http://example.com/')
|
|
255
255
|
|
|
256
256
|
click_button("Save")
|
|
@@ -281,7 +281,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
281
281
|
expect(page).to have_selector "input.collection_creator.multi_value"
|
|
282
282
|
|
|
283
283
|
fill_in('Title', with: title)
|
|
284
|
-
fill_in('
|
|
284
|
+
fill_in('Description', with: description)
|
|
285
285
|
fill_in('Related URL', with: 'http://example.com/')
|
|
286
286
|
|
|
287
287
|
click_button("Save")
|
|
@@ -328,8 +328,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
328
328
|
end
|
|
329
329
|
|
|
330
330
|
describe 'delete collection' do
|
|
331
|
-
let!(:empty_collection) { create(:
|
|
332
|
-
let!(:collection) { create(:
|
|
331
|
+
let!(:empty_collection) { create(:public_collection_lw, title: ['Empty Collection'], user: user, with_permission_template: true) }
|
|
332
|
+
let!(:collection) { create(:public_collection_lw, title: ['Collection with Work'], user: user, with_permission_template: true) }
|
|
333
333
|
let!(:admin_user) { create(:admin) }
|
|
334
334
|
let!(:empty_adminset) { create(:admin_set, title: ['Empty Admin Set'], creator: [admin_user.user_key], with_permission_template: true) }
|
|
335
335
|
let!(:adminset) { create(:admin_set, title: ['Admin Set with Work'], creator: [admin_user.user_key], with_permission_template: true) }
|
|
@@ -564,7 +564,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
564
564
|
|
|
565
565
|
describe 'collection show page' do
|
|
566
566
|
let(:collection) do
|
|
567
|
-
|
|
567
|
+
build(:public_collection_lw, user: user, description: ['collection description'], with_permission_template: true)
|
|
568
568
|
end
|
|
569
569
|
let!(:work1) { create(:work, title: ["King Louie"], member_of_collections: [collection], user: user) }
|
|
570
570
|
let!(:work2) { create(:work, title: ["King Kong"], member_of_collections: [collection], user: user) }
|
|
@@ -707,7 +707,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
707
707
|
|
|
708
708
|
sign_in user
|
|
709
709
|
end
|
|
710
|
-
let(:collection) { create(:
|
|
710
|
+
let(:collection) { create(:named_collection_lw, user: user, with_permission_template: true) }
|
|
711
711
|
|
|
712
712
|
it "shows a collection with a listing of Descriptive Metadata and catalog-style search results" do
|
|
713
713
|
visit '/dashboard/my/collections'
|
|
@@ -762,7 +762,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
762
762
|
end
|
|
763
763
|
|
|
764
764
|
describe 'edit collection' do
|
|
765
|
-
let(:collection) {
|
|
765
|
+
let(:collection) { build(:named_collection_lw, user: user, with_permission_template: true) }
|
|
766
766
|
let!(:work1) { create(:work, title: ["King Louie"], member_of_collections: [collection], user: user) }
|
|
767
767
|
let!(:work2) { create(:work, title: ["King Kong"], member_of_collections: [collection], user: user) }
|
|
768
768
|
|
|
@@ -815,7 +815,7 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
815
815
|
creators = ["Dorje Trollo", "Vajrayogini"]
|
|
816
816
|
|
|
817
817
|
fill_in('Title', with: new_title)
|
|
818
|
-
fill_in('
|
|
818
|
+
fill_in('Description', with: new_description)
|
|
819
819
|
fill_in('Creator', with: creators.first)
|
|
820
820
|
within('.panel-footer') do
|
|
821
821
|
click_button('Save changes')
|
|
@@ -856,8 +856,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
856
856
|
end
|
|
857
857
|
|
|
858
858
|
context 'with brandable set' do
|
|
859
|
-
let(:brandable_collection_id) { create(:
|
|
860
|
-
let(:not_brandable_collection_id) { create(:
|
|
859
|
+
let(:brandable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:brandable], with_permission_template: true).id }
|
|
860
|
+
let(:not_brandable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_brandable], with_permission_template: true).id }
|
|
861
861
|
|
|
862
862
|
it 'to true, it shows Branding tab' do
|
|
863
863
|
visit "/dashboard/collections/#{brandable_collection_id}/edit"
|
|
@@ -871,8 +871,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
871
871
|
end
|
|
872
872
|
|
|
873
873
|
context 'with discoverable set' do
|
|
874
|
-
let(:discoverable_collection_id) { create(:
|
|
875
|
-
let(:not_discoverable_collection_id) { create(:
|
|
874
|
+
let(:discoverable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:discoverable], with_permission_template: true).id }
|
|
875
|
+
let(:not_discoverable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_discoverable], with_permission_template: true).id }
|
|
876
876
|
|
|
877
877
|
it 'to true, it shows Discovery tab' do
|
|
878
878
|
visit "/dashboard/collections/#{discoverable_collection_id}/edit"
|
|
@@ -886,8 +886,8 @@ RSpec.describe 'collection', type: :feature, clean_repo: true do
|
|
|
886
886
|
end
|
|
887
887
|
|
|
888
888
|
context 'with sharable set' do
|
|
889
|
-
let(:sharable_collection_id) { create(:
|
|
890
|
-
let(:not_sharable_collection_id) { create(:
|
|
889
|
+
let(:sharable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:sharable], with_permission_template: true).id }
|
|
890
|
+
let(:not_sharable_collection_id) { create(:collection_lw, user: user, collection_type_settings: [:not_sharable], with_permission_template: true).id }
|
|
891
891
|
|
|
892
892
|
it 'to true, it shows Sharable tab' do
|
|
893
893
|
visit "/dashboard/collections/#{sharable_collection_id}/edit"
|
|
@@ -16,7 +16,7 @@ RSpec.describe 'Deleting a work', type: :feature do
|
|
|
16
16
|
it 'redirects to my dashboard' do
|
|
17
17
|
visit hyrax_generic_work_path(work)
|
|
18
18
|
click_on('Delete', match: :first)
|
|
19
|
-
expect(page).to have_current_path(hyrax.my_works_path,
|
|
19
|
+
expect(page).to have_current_path(hyrax.my_works_path, ignore_query: true)
|
|
20
20
|
expect(page).to have_content 'Deleted Test title'
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -9,7 +9,7 @@ RSpec.describe 'searching' do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
let!(:collection) do
|
|
12
|
-
create(:
|
|
12
|
+
create(:public_collection_lw, title: ['collection title abc'], description: [subject_value], user: user, members: [work])
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
context "as a public user", :clean_repo do
|
|
@@ -53,7 +53,7 @@ RSpec.describe 'searching' do
|
|
|
53
53
|
expect(page).to have_content('Search Results')
|
|
54
54
|
expect(page).to have_content "Toothbrush"
|
|
55
55
|
expect(page).to have_content('collection title abc')
|
|
56
|
-
expect(page).to
|
|
56
|
+
expect(page).to have_selector("//img")
|
|
57
57
|
|
|
58
58
|
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=taco&locale=en\">taco</a></span>"
|
|
59
59
|
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=mustache&locale=en\">mustache</a></span>"
|
|
@@ -53,11 +53,14 @@ RSpec.describe "work show view" do
|
|
|
53
53
|
it "allows adding work to a collection", clean_repo: true, js: true do
|
|
54
54
|
optional 'ability to get capybara to find css select2-result (see Issue #3038)' if ci_build?
|
|
55
55
|
click_button "Add to collection" # opens the modal
|
|
56
|
-
|
|
56
|
+
# Really ensure that this Collection model is persisted
|
|
57
|
+
Collection.all.map(&:destroy!)
|
|
58
|
+
persisted_collection = create(:collection_lw, user: user, collection_type_gid: multi_membership_type_1.gid)
|
|
59
|
+
select_member_of_collection(persisted_collection)
|
|
57
60
|
click_button 'Save changes'
|
|
58
61
|
|
|
59
62
|
# forwards to collection show page
|
|
60
|
-
expect(page).to have_content
|
|
63
|
+
expect(page).to have_content persisted_collection.title.first
|
|
61
64
|
expect(page).to have_content work.title.first
|
|
62
65
|
expect(page).to have_selector '.alert-success', text: 'Collection was successfully updated.'
|
|
63
66
|
end
|
|
@@ -24,7 +24,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
let(:collection) { build(:
|
|
27
|
+
let(:collection) { build(:collection_lw) }
|
|
28
28
|
let(:ability) { Ability.new(create(:user)) }
|
|
29
29
|
let(:repository) { double }
|
|
30
30
|
let(:form) { described_class.new(collection, ability, repository) }
|
|
@@ -74,8 +74,8 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
context "nested relationships" do
|
|
77
|
-
let(:child_collection) { build(:
|
|
78
|
-
let(:parent_collection) { build(:
|
|
77
|
+
let(:child_collection) { build(:collection_lw) }
|
|
78
|
+
let(:parent_collection) { build(:collection_lw) }
|
|
79
79
|
let(:service_object) { double(available_member_subcollections: double(documents: [child_collection])) }
|
|
80
80
|
|
|
81
81
|
before do
|
|
@@ -174,7 +174,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
|
174
174
|
subject { form.permission_template }
|
|
175
175
|
|
|
176
176
|
context "when the PermissionTemplate doesn't exist" do
|
|
177
|
-
let(:model) {
|
|
177
|
+
let(:model) { build(:collection_lw) }
|
|
178
178
|
|
|
179
179
|
it "gets created" do
|
|
180
180
|
expect(subject).to be_instance_of Hyrax::Forms::PermissionTemplateForm
|
|
@@ -185,7 +185,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
|
|
|
185
185
|
context "when the PermissionTemplate exists" do
|
|
186
186
|
let(:form) { described_class.new(model, ability, repository) }
|
|
187
187
|
let(:permission_template) { Hyrax::PermissionTemplate.find_by(source_id: model.id) }
|
|
188
|
-
let(:model) {
|
|
188
|
+
let(:model) { build(:collection_lw, with_permission_template: true) }
|
|
189
189
|
|
|
190
190
|
it "uses the existing template" do
|
|
191
191
|
expect(subject).to be_instance_of Hyrax::Forms::PermissionTemplateForm
|
|
@@ -3,7 +3,7 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
|
|
|
3
3
|
let(:form) { described_class.new(permission_template) }
|
|
4
4
|
let(:today) { Time.zone.today }
|
|
5
5
|
let(:admin_set) { create(:admin_set) }
|
|
6
|
-
let(:collection) {
|
|
6
|
+
let(:collection) { build(:collection_lw) }
|
|
7
7
|
|
|
8
8
|
subject { form }
|
|
9
9
|
|
|
@@ -109,6 +109,7 @@ RSpec.describe Hyrax::Forms::WorkForm do
|
|
|
109
109
|
keyword: ['penguin'],
|
|
110
110
|
source: ['related'],
|
|
111
111
|
rights_statement: 'http://rightsstatements.org/vocab/InC-EDU/1.0/',
|
|
112
|
+
rights_notes: ['Notes on the rights'],
|
|
112
113
|
license: ['http://creativecommons.org/licenses/by/3.0/us/']
|
|
113
114
|
}
|
|
114
115
|
end
|
|
@@ -121,6 +122,7 @@ RSpec.describe Hyrax::Forms::WorkForm do
|
|
|
121
122
|
expect(subject['visibility']).to eq 'open'
|
|
122
123
|
expect(subject['license']).to eq ['http://creativecommons.org/licenses/by/3.0/us/']
|
|
123
124
|
expect(subject['rights_statement']).to eq 'http://rightsstatements.org/vocab/InC-EDU/1.0/'
|
|
125
|
+
expect(subject['rights_notes']).to eq ['Notes on the rights']
|
|
124
126
|
expect(subject['keyword']).to eq ['penguin']
|
|
125
127
|
expect(subject['source']).to eq ['related']
|
|
126
128
|
end
|
|
@@ -33,7 +33,9 @@ RSpec.describe BlacklightHelper, type: :helper do
|
|
|
33
33
|
search_catalog_path(stuff)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
let(:presenter) { index_presenter(document) }
|
|
37
|
+
let(:field) { blacklight_config.index_fields.fetch(field_name) }
|
|
38
|
+
subject { presenter.field_value field }
|
|
37
39
|
|
|
38
40
|
context "description_tesim" do
|
|
39
41
|
let(:field_name) { 'description_tesim' }
|
|
@@ -47,6 +47,48 @@ RSpec.describe Hyrax::CollectionsHelper do
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
describe '#render_other_collection_links' do
|
|
51
|
+
before do
|
|
52
|
+
allow(controller).to receive(:current_ability).and_return(ability)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context 'when a GenericWork belongs to one collection' do
|
|
56
|
+
let(:coll_ids) { ['111'] }
|
|
57
|
+
let(:coll_titles) { ['Collection 111'] }
|
|
58
|
+
let(:coll1_attrs) { { id: coll_ids[0], title_tesim: [coll_titles[0]] } }
|
|
59
|
+
let!(:work_doc) { SolrDocument.new(id: '123', title_tesim: ['My GenericWork'], member_of_collection_ids_ssim: coll_ids) }
|
|
60
|
+
|
|
61
|
+
before do
|
|
62
|
+
ActiveFedora::SolrService.add(coll1_attrs)
|
|
63
|
+
ActiveFedora::SolrService.commit
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'renders nothing' do
|
|
67
|
+
expect(helper.render_other_collection_links(work_doc, coll_ids[0])).to be_nil
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
context 'when a GenericWork belongs to more than one collection' do
|
|
72
|
+
let(:coll_ids) { ['111', '222'] }
|
|
73
|
+
let(:coll_titles) { ['Collection 111', 'Collection 222'] }
|
|
74
|
+
let(:coll1_attrs) { { id: coll_ids[0], title_tesim: [coll_titles[0]] } }
|
|
75
|
+
let(:coll2_attrs) { { id: coll_ids[1], title_tesim: [coll_titles[1]] } }
|
|
76
|
+
let!(:work_doc) { SolrDocument.new(id: '123', title_tesim: ['My GenericWork'], member_of_collection_ids_ssim: coll_ids) }
|
|
77
|
+
|
|
78
|
+
before do
|
|
79
|
+
ActiveFedora::SolrService.add(coll1_attrs)
|
|
80
|
+
ActiveFedora::SolrService.add(coll2_attrs)
|
|
81
|
+
ActiveFedora::SolrService.commit
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'renders a list of links to the collections' do
|
|
85
|
+
expect(helper.render_other_collection_links(work_doc, coll_ids[0])).to match(/This work also belongs to/i)
|
|
86
|
+
expect(helper.render_other_collection_links(work_doc, coll_ids[0])).to match("href=\"/collections/#{coll_ids[1]}\"")
|
|
87
|
+
expect(helper.render_other_collection_links(work_doc, coll_ids[0])).to match(coll_titles[1])
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
50
92
|
describe "has_collection_search_parameters?" do
|
|
51
93
|
subject { helper }
|
|
52
94
|
|
|
@@ -62,13 +62,13 @@ RSpec.describe Hyrax::DashboardHelperBehavior, type: :helper do
|
|
|
62
62
|
def create_models(model, user1, user2)
|
|
63
63
|
# deposited by the first user
|
|
64
64
|
3.times do |t|
|
|
65
|
-
conn.add id: "199#{t}",
|
|
66
|
-
|
|
65
|
+
conn.add id: "199#{t}", ActiveFedora.index_field_mapper.solr_name('depositor', :stored_searchable) => user1.user_key, "has_model_ssim" => [model],
|
|
66
|
+
ActiveFedora.index_field_mapper.solr_name('depositor', :symbol) => user1.user_key
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# deposited by the second user, but editable by the first
|
|
70
|
-
conn.add id: "1994",
|
|
71
|
-
|
|
70
|
+
conn.add id: "1994", ActiveFedora.index_field_mapper.solr_name('depositor', :stored_searchable) => user2.user_key, "has_model_ssim" => [model],
|
|
71
|
+
ActiveFedora.index_field_mapper.solr_name('depositor', :symbol) => user2.user_key, "edit_access_person_ssim" => user1.user_key
|
|
72
72
|
conn.commit
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -117,7 +117,7 @@ RSpec.describe HyraxHelper, type: :helper do
|
|
|
117
117
|
subject { helper.link_to_each_facet_field(options) }
|
|
118
118
|
|
|
119
119
|
context "with helper_facet and default separator" do
|
|
120
|
-
let(:options) { { config: { helper_facet:
|
|
120
|
+
let(:options) { { config: { helper_facet: ActiveFedora.index_field_mapper.solr_name("document_types", :facetable).to_sym }, value: ["Imaging > Object Photography"] } }
|
|
121
121
|
|
|
122
122
|
it do
|
|
123
123
|
is_expected.to eq("<a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Imaging\">" \
|
|
@@ -127,7 +127,7 @@ RSpec.describe HyraxHelper, type: :helper do
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
context "with helper_facet and optional separator" do
|
|
130
|
-
let(:options) { { config: { helper_facet:
|
|
130
|
+
let(:options) { { config: { helper_facet: ActiveFedora.index_field_mapper.solr_name("document_types", :facetable).to_sym, separator: " : " }, value: ["Imaging : Object Photography"] } }
|
|
131
131
|
|
|
132
132
|
it do
|
|
133
133
|
is_expected.to eq("<a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Imaging\">" \
|
|
@@ -137,7 +137,9 @@ RSpec.describe HyraxHelper, type: :helper do
|
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
context "with :output_separator" do
|
|
140
|
-
let(:options)
|
|
140
|
+
let(:options) do
|
|
141
|
+
{ config: { helper_facet: ActiveFedora.index_field_mapper.solr_name("document_types", :facetable).to_sym, output_separator: ' ~ ', separator: ":" }, value: ["Imaging : Object Photography"] }
|
|
142
|
+
end
|
|
141
143
|
|
|
142
144
|
it do
|
|
143
145
|
is_expected.to eq("<a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Imaging\">" \
|
|
@@ -147,7 +149,9 @@ RSpec.describe HyraxHelper, type: :helper do
|
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
context "with :no_spaces_around_separator" do
|
|
150
|
-
let(:options)
|
|
152
|
+
let(:options) do
|
|
153
|
+
{ config: { helper_facet: ActiveFedora.index_field_mapper.solr_name("document_types", :facetable).to_sym, output_separator: '~', separator: ":" }, value: ["Imaging : Object Photography"] }
|
|
154
|
+
end
|
|
151
155
|
|
|
152
156
|
it do
|
|
153
157
|
is_expected.to eq("<a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Imaging\">" \
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'hyrax/transactions'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Hyrax::Transactions::DestroyWork do
|
|
6
|
+
subject(:transaction) { described_class.new }
|
|
7
|
+
let(:work) { create(:generic_work) }
|
|
8
|
+
|
|
9
|
+
describe '#call' do
|
|
10
|
+
it 'is a success' do
|
|
11
|
+
expect(transaction.call(work)).to be_success
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'destroys the work' do
|
|
15
|
+
expect { transaction.call(work) }
|
|
16
|
+
.to change { work.persisted? }
|
|
17
|
+
.from(true)
|
|
18
|
+
.to false
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context 'with an unsaved work' do
|
|
22
|
+
let(:work) { build(:generic_work) }
|
|
23
|
+
|
|
24
|
+
it 'is a success' do
|
|
25
|
+
expect(transaction.call(work)).to be_success
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'leaves the work unpersisted' do
|
|
29
|
+
expect { transaction.call(work) }
|
|
30
|
+
.not_to change { work.persisted? }
|
|
31
|
+
.from false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'hyrax/transactions'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Hyrax::Transactions::Steps::DestroyWork do
|
|
6
|
+
subject(:step) { described_class.new }
|
|
7
|
+
let(:work) { build(:generic_work) }
|
|
8
|
+
|
|
9
|
+
it 'is a success' do
|
|
10
|
+
expect(step.call(work)).to be_success
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'with an existing work' do
|
|
14
|
+
let(:work) { create(:generic_work) }
|
|
15
|
+
|
|
16
|
+
it 'destroys the work' do
|
|
17
|
+
expect { step.call(work) }
|
|
18
|
+
.to change { work.persisted? }
|
|
19
|
+
.from(true)
|
|
20
|
+
.to false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'when destruction fails for an unknown reason' do
|
|
24
|
+
let(:message) { 'moomin message' }
|
|
25
|
+
|
|
26
|
+
before { allow(work).to receive(:destroy).and_raise(message) }
|
|
27
|
+
|
|
28
|
+
it 'is a failure' do
|
|
29
|
+
expect(step.call(work).failure).to have_attributes(message: message)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
RSpec.describe Hyrax::CollectionIndexer do
|
|
2
2
|
let(:indexer) { described_class.new(collection) }
|
|
3
|
-
let(:collection) { build(:
|
|
3
|
+
let(:collection) { build(:collection_lw) }
|
|
4
4
|
let(:col1id) { 'col1' }
|
|
5
5
|
let(:col2id) { 'col2' }
|
|
6
6
|
let(:col1title) { 'col1 title' }
|
|
@@ -52,7 +52,7 @@ RSpec.describe CharacterizeJob do
|
|
|
52
52
|
|
|
53
53
|
context "when the file set's work is in a collection" do
|
|
54
54
|
let(:work) { build(:generic_work) }
|
|
55
|
-
let(:collection) { build(:
|
|
55
|
+
let(:collection) { build(:collection_lw) }
|
|
56
56
|
|
|
57
57
|
before do
|
|
58
58
|
allow(file_set).to receive(:parent).and_return(work)
|