hyrax 2.1.0.beta1 → 2.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -49
- data/.rubocop_fixme.yml +1 -0
- data/.travis.yml +1 -1
- data/Gemfile +3 -3
- data/README.md +4 -2
- data/app/actors/hyrax/actors/file_set_actor.rb +0 -1
- data/app/actors/hyrax/actors/interpret_visibility_actor.rb +1 -3
- data/app/actors/hyrax/actors/model_actor.rb +4 -0
- data/app/assets/javascripts/hyrax.js +1 -1
- data/app/assets/javascripts/hyrax/app.js.erb +1 -1
- data/app/assets/javascripts/hyrax/authority_select.es6 +15 -7
- data/app/assets/javascripts/hyrax/collections.js +188 -9
- data/app/assets/javascripts/hyrax/content_blocks.js +13 -1
- data/app/assets/javascripts/hyrax/editor.es6 +2 -1
- data/app/assets/javascripts/hyrax/proxy_rights.js +2 -2
- data/app/assets/javascripts/hyrax/turbolinks_events.js +5 -0
- data/app/assets/stylesheets/hyrax/_accessibility.scss +21 -0
- data/app/assets/stylesheets/hyrax/_catalog.scss +21 -16
- data/app/assets/stylesheets/hyrax/_collections.scss +48 -7
- data/app/assets/stylesheets/hyrax/_modal.scss +4 -0
- data/app/assets/stylesheets/hyrax/_settings.scss +1 -1
- data/app/assets/stylesheets/hyrax/dashboard.scss +0 -1
- data/app/controllers/concerns/hyrax/breadcrumbs.rb +3 -1
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +17 -1
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +10 -0
- data/app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb +86 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +14 -11
- data/app/controllers/hyrax/admin/collection_types_controller.rb +11 -1
- data/app/controllers/hyrax/api/items_controller.rb +2 -6
- data/app/controllers/hyrax/batch_edits_controller.rb +6 -0
- data/app/controllers/hyrax/batch_uploads_controller.rb +1 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -7
- data/app/controllers/hyrax/dashboard/profiles_controller.rb +2 -0
- data/app/controllers/hyrax/dashboard_controller.rb +2 -2
- data/app/controllers/hyrax/depositors_controller.rb +19 -0
- data/app/controllers/hyrax/downloads_controller.rb +3 -4
- data/app/controllers/hyrax/embargoes_controller.rb +2 -0
- data/app/controllers/hyrax/file_sets_controller.rb +12 -0
- data/app/controllers/hyrax/leases_controller.rb +2 -0
- data/app/controllers/hyrax/my/works_controller.rb +9 -0
- data/app/controllers/hyrax/my_controller.rb +0 -1
- data/app/controllers/hyrax/transfers_controller.rb +1 -3
- data/app/controllers/hyrax/users_controller.rb +1 -3
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
- data/app/forms/hyrax/forms/permission_template_form.rb +1 -4
- data/app/forms/hyrax/forms/work_form.rb +1 -3
- data/app/helpers/hyrax/citations_behaviors/common_behavior.rb +1 -3
- data/app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb +1 -5
- data/app/helpers/hyrax/collections_helper.rb +7 -4
- data/app/helpers/hyrax/file_set_helper.rb +0 -1
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -1
- data/app/helpers/hyrax/trophy_helper.rb +0 -1
- data/app/indexers/hyrax/admin_set_indexer.rb +2 -0
- data/app/inputs/multi_value_select_input.rb +1 -3
- data/app/jobs/attach_files_to_work_job.rb +5 -1
- data/app/jobs/import_url_job.rb +9 -8
- data/app/models/admin_set.rb +1 -5
- data/app/models/concerns/hyrax/ability.rb +3 -4
- data/app/models/concerns/hyrax/collection_behavior.rb +0 -4
- data/app/models/concerns/hyrax/collection_nesting.rb +12 -0
- data/app/models/concerns/hyrax/suppressible.rb +1 -5
- data/app/models/featured_work_list.rb +1 -3
- data/app/models/hyrax/collection_type.rb +3 -2
- data/app/models/hyrax/permission_template_access.rb +6 -4
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/presenters/hyrax/collection_presenter.rb +0 -24
- data/app/presenters/hyrax/displays_image.rb +1 -1
- data/app/presenters/hyrax/file_set_presenter.rb +1 -1
- data/app/presenters/hyrax/menu_presenter.rb +1 -1
- data/app/presenters/hyrax/work_show_presenter.rb +15 -10
- data/app/search_builders/hyrax/abstract_type_relation.rb +2 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +1 -1
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +3 -1
- data/app/search_builders/hyrax/parent_collection_search_builder.rb +2 -2
- data/app/services/hyrax/admin_set_create_service.rb +1 -3
- data/app/services/hyrax/analytics.rb +1 -3
- data/app/services/hyrax/collection_member_service.rb +6 -5
- data/app/services/hyrax/collection_types/create_service.rb +37 -10
- data/app/services/hyrax/collections/permissions_create_service.rb +1 -3
- data/app/services/hyrax/collections/permissions_service.rb +6 -4
- data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
- data/app/views/catalog/_index_header_list_default.html.erb +1 -1
- data/app/views/catalog/_index_list_default.html.erb +6 -10
- data/app/views/catalog/_search_form.html.erb +10 -11
- data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
- data/app/views/catalog/_thumbnail_list_default.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +3 -3
- data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/index.html.erb +1 -1
- data/app/views/hyrax/admin/appearances/show.html.erb +4 -4
- data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +3 -2
- data/app/views/hyrax/admin/collection_types/index.html.erb +2 -2
- data/app/views/hyrax/admin/features/index.html.erb +2 -4
- data/app/views/hyrax/admin/stats/_date_form.html.erb +3 -3
- data/app/views/hyrax/admin/stats/_top_data.html.erb +1 -1
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/admin/workflows/index.html.erb +0 -1
- data/app/views/hyrax/base/_file_manager_actions.html.erb +2 -2
- data/app/views/hyrax/base/_file_manager_member.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_files.html.erb +3 -3
- data/app/views/hyrax/base/_form_member_of_collections.html.erb +1 -2
- data/app/views/hyrax/base/_form_progress.html.erb +3 -3
- data/app/views/hyrax/base/_form_relationships.html.erb +2 -3
- data/app/views/hyrax/base/_form_representative.html.erb +0 -1
- data/app/views/hyrax/base/_form_share.html.erb +1 -3
- data/app/views/hyrax/base/_form_thumbnail.html.erb +0 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +6 -6
- data/app/views/hyrax/base/_relationships_parent_rows.html.erb +3 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_share_with.html.erb +3 -3
- data/app/views/hyrax/base/_show_actions.html.erb +14 -1
- data/app/views/hyrax/base/_social_media.html.erb +5 -5
- data/app/views/hyrax/base/_work_title.erb +3 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
- data/app/views/hyrax/base/inspect_work.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_edits/_check_all.html.erb +2 -2
- data/app/views/hyrax/batch_edits/edit.html.erb +47 -44
- data/app/views/hyrax/batch_select/_add_button.html.erb +2 -2
- data/app/views/hyrax/citations/work.html.erb +3 -3
- data/app/views/hyrax/collections/_collection.html.erb +1 -1
- data/app/views/hyrax/collections/_default_group.html.erb +1 -1
- data/app/views/hyrax/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/collections/_show_descriptions.html.erb +6 -6
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/collections/_show_parent_collections.html.erb +11 -38
- data/app/views/hyrax/collections/_sort_and_per_page.html.erb +13 -13
- data/app/views/hyrax/collections/_subcollection_list.html.erb +1 -1
- data/app/views/hyrax/collections/_view_type_group.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +122 -122
- data/app/views/hyrax/content_blocks/_form.html.erb +13 -12
- data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +15 -0
- data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +25 -19
- data/app/views/hyrax/dashboard/_sidebar.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +16 -16
- data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -1
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +11 -11
- data/app/views/hyrax/dashboard/collections/_form_default_group_delt.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +4 -4
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +51 -44
- data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +4 -4
- data/app/views/hyrax/dashboard/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_modal_remove_from_collection.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_modal_remove_sub_collection.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_show_parent_collections.html.erb +11 -34
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_subcollection_list.html.erb +23 -17
- data/app/views/hyrax/dashboard/collections/show.html.erb +6 -6
- data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +0 -4
- data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +16 -14
- data/app/views/hyrax/dashboard/profiles/show.html.erb +6 -0
- data/app/views/hyrax/dashboard/show_admin.html.erb +19 -3
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +6 -0
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/depositors/index.html.erb +13 -0
- data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
- data/app/views/hyrax/embargoes/edit.html.erb +47 -35
- data/app/views/hyrax/embargoes/index.html.erb +6 -7
- data/app/views/hyrax/file_sets/_actions.html.erb +6 -2
- data/app/views/hyrax/file_sets/_extra_fields_modal.html.erb +3 -3
- data/app/views/hyrax/file_sets/_groups_description.html.erb +0 -1
- data/app/views/hyrax/file_sets/_permission_form.html.erb +3 -3
- data/app/views/hyrax/file_sets/edit.html.erb +24 -20
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +23 -6
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +23 -6
- data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +1 -1
- data/app/views/hyrax/leases/edit.html.erb +47 -35
- data/app/views/hyrax/leases/index.html.erb +6 -6
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -1
- data/app/views/hyrax/my/_facet_limit.html.erb +1 -2
- data/app/views/hyrax/my/_facet_pagination.html.erb +6 -6
- data/app/views/hyrax/my/_facet_pivot.html.erb +1 -1
- data/app/views/hyrax/my/_results_pagination.html.erb +1 -1
- data/app/views/hyrax/my/collections/_facets.html.erb +1 -1
- data/app/views/hyrax/my/collections/_list_collections.html.erb +5 -5
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -2
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +3 -1
- data/app/views/hyrax/my/collections/_modal_add_to_collection_permission_deny.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +2 -2
- data/app/views/hyrax/my/collections/_modal_delete_collection.html.erb +1 -2
- data/app/views/hyrax/my/collections/_modal_delete_deny.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_delete_selected_collections.html.erb +2 -2
- data/app/views/hyrax/my/collections/_tabs.html.erb +2 -2
- data/app/views/hyrax/my/collections/index.html.erb +7 -3
- data/app/views/hyrax/my/facet.html.erb +1 -1
- data/app/views/hyrax/my/index.html.erb +6 -2
- data/app/views/hyrax/my/works/_facets.html.erb +1 -1
- data/app/views/hyrax/my/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/my/works/_tabs.html.erb +2 -2
- data/app/views/hyrax/my/works/index.html.erb +6 -2
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
- data/app/views/hyrax/pages/_form.html.erb +12 -12
- data/app/views/hyrax/pages/show.html.erb +1 -1
- data/app/views/hyrax/single_use_links_viewer/show.html.erb +1 -1
- data/app/views/hyrax/stats/file.html.erb +6 -2
- data/app/views/hyrax/stats/work.html.erb +6 -2
- data/app/views/hyrax/transfers/_received.html.erb +6 -6
- data/app/views/hyrax/transfers/_sent.html.erb +2 -2
- data/app/views/hyrax/transfers/new.html.erb +0 -1
- data/app/views/hyrax/users/_activity_log.html.erb +2 -2
- data/app/views/hyrax/users/_profile_tabs.html.erb +1 -1
- data/app/views/hyrax/users/_search_form.html.erb +1 -1
- data/app/views/hyrax/users/_user.html.erb +0 -1
- data/app/views/hyrax/users/index.html.erb +1 -1
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -2
- data/app/views/layouts/_head_tag_content.html.erb +2 -2
- data/app/views/layouts/error.html.erb +1 -1
- data/app/views/layouts/hyrax.html.erb +6 -3
- data/app/views/layouts/hyrax/dashboard.html.erb +6 -3
- data/app/views/records/show_fields/_based_near.html.erb +0 -1
- data/app/views/records/show_fields/_contributor.html.erb +0 -1
- data/app/views/records/show_fields/_date_created.html.erb +0 -1
- data/app/views/records/show_fields/_description.html.erb +1 -1
- data/app/views/records/show_fields/_identifier.html.erb +0 -1
- data/app/views/records/show_fields/_language.html.erb +0 -1
- data/app/views/records/show_fields/_publisher.html.erb +0 -1
- data/app/views/records/show_fields/_related_url.html.erb +0 -1
- data/app/views/records/show_fields/_resource_type.html.erb +0 -1
- data/app/views/records/show_fields/_subject.html.erb +0 -1
- data/app/views/shared/_citations.html.erb +17 -17
- data/app/views/shared/_select_work_type_modal.html.erb +2 -2
- data/config/locales/hyrax.de.yml +198 -189
- data/config/locales/hyrax.en.yml +21 -14
- data/config/locales/hyrax.es.yml +9 -0
- data/config/locales/hyrax.fr.yml +9 -0
- data/config/locales/hyrax.it.yml +9 -0
- data/config/locales/hyrax.pt-BR.yml +9 -0
- data/config/locales/hyrax.zh.yml +9 -0
- data/config/routes.rb +1 -0
- data/hyrax.gemspec +7 -18
- data/lib/generators/hyrax/models_generator.rb +0 -1
- data/lib/generators/hyrax/templates/db/migrate/20180302200051_add_branding_to_collection_type.rb.erb +5 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +1 -1
- data/lib/hyrax/configuration.rb +2 -4
- data/lib/hyrax/engine.rb +22 -4
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/lease_actor_spec.rb +16 -0
- data/spec/controllers/hyrax/admin/appearances_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +2 -0
- data/spec/controllers/hyrax/admin/features_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/workflows_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +14 -1
- data/spec/controllers/hyrax/batch_uploads_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/citations_controller_spec.rb +4 -2
- data/spec/controllers/hyrax/collections_controller_spec.rb +32 -4
- data/spec/controllers/hyrax/content_blocks_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +11 -6
- data/spec/controllers/hyrax/depositors_controller_spec.rb +11 -0
- data/spec/controllers/hyrax/downloads_controller_spec.rb +42 -0
- data/spec/controllers/hyrax/embargoes_controller_spec.rb +40 -1
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +10 -2
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +38 -6
- data/spec/controllers/hyrax/leases_controller_spec.rb +11 -0
- data/spec/controllers/hyrax/my/collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/my/works_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/pages_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/stats_controller_spec.rb +2 -0
- data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
- data/spec/factories/collection_types.rb +10 -1
- data/spec/factories/collections.rb +5 -3
- data/spec/factories/collections_factory.rb +3 -3
- data/spec/factories/file_sets.rb +2 -6
- data/spec/factories/generic_works.rb +68 -4
- data/spec/factory_tests/collections_factory_spec.rb +2 -1
- data/spec/features/batch_create_spec.rb +60 -0
- data/spec/features/batch_edit_spec.rb +1 -0
- data/spec/features/browse_dashboard_works_spec.rb +1 -0
- data/spec/features/collection_multi_membership_spec.rb +9 -6
- data/spec/features/collection_spec.rb +1 -1
- data/spec/features/collection_type_spec.rb +49 -1
- data/spec/features/create_work_admin_spec.rb +2 -2
- data/spec/features/create_work_spec.rb +1 -0
- data/spec/features/dashboard/all_works.rb +10 -2
- data/spec/features/dashboard/collection_spec.rb +38 -17
- data/spec/features/dashboard/display_admin_dashboard_spec.rb +29 -0
- data/spec/features/dashboard/display_dashboard_spec.rb +1 -1
- data/spec/features/edit_content_block_admin_spec.rb +45 -0
- data/spec/features/edit_work_spec.rb +40 -2
- data/spec/features/ownership_transfer_spec.rb +1 -0
- data/spec/features/proxy_spec.rb +2 -2
- data/spec/features/search_spec.rb +2 -5
- data/spec/features/work_show_spec.rb +14 -4
- data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
- data/spec/forms/hyrax/forms/collection_form_spec.rb +1 -1
- data/spec/helpers/hyrax/ability_helper_spec.rb +2 -2
- data/spec/helpers/hyrax/collections_helper_spec.rb +12 -4
- data/spec/javascripts/authority_select_spec.js +1 -1
- data/spec/javascripts/settings_spec.js +1 -0
- data/spec/jobs/attach_files_to_work_job_spec.rb +13 -0
- data/spec/jobs/import_url_job_spec.rb +14 -0
- data/spec/models/collection_spec.rb +1 -0
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +16 -0
- data/spec/models/hyrax/collection_type_spec.rb +1 -0
- data/spec/presenters/hyrax/collection_presenter_spec.rb +1 -100
- data/spec/presenters/hyrax/file_set_presenter_spec.rb +17 -2
- data/spec/presenters/hyrax/menu_presenter_spec.rb +6 -0
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +15 -3
- data/spec/search_builders/hyrax/abstract_type_relation_spec.rb +18 -0
- data/spec/search_builders/hyrax/dashboard/collections_search_builder_spec.rb +30 -19
- data/spec/search_builders/hyrax/parent_collection_search_builder_spec.rb +15 -0
- data/spec/services/hyrax/collection_member_service_spec.rb +10 -19
- data/spec/services/hyrax/collection_types/create_service_spec.rb +35 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +1 -1
- data/spec/services/hyrax/qa_select_service_spec.rb +0 -1
- data/spec/support/selectors.rb +15 -0
- data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +2 -0
- data/spec/views/hyrax/admin/collection_types/_form_settings.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/admin/stats/show.html.erb_spec.rb +9 -0
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +13 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +10 -0
- data/spec/views/hyrax/base/show.html.erb_spec.rb +8 -0
- data/spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb +3 -53
- data/spec/views/hyrax/dashboard/_sidebar.html.erb_spec.rb +22 -0
- data/spec/views/hyrax/dashboard/collections/_form_share.erb_spec.rb +2 -1
- data/spec/views/hyrax/dashboard/collections/_show_actions.html.erb_spec.rb +13 -0
- data/spec/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb_spec.rb +26 -8
- data/spec/views/hyrax/dashboard/collections/_show_parent_collections.html.erb_spec.rb +7 -43
- data/spec/views/hyrax/dashboard/collections/_subcollection_list.html.erb_spec.rb +13 -1
- data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/dashboard/profiles/_trophy_edit.html.erb_spec.rb +36 -0
- data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +0 -38
- data/spec/views/hyrax/dashboard/profiles/show.html.erb_spec.rb +37 -0
- data/spec/views/hyrax/depositors/index.html.erb_spec.rb +13 -0
- data/spec/views/hyrax/file_sets/_actions.html.erb_spec.rb +15 -0
- data/spec/views/hyrax/file_sets/media_display/_audio.html.erb_spec.rb +29 -0
- data/spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/file_sets/media_display/_video.html.erb_spec.rb +29 -0
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +6 -2
- data/tasks/hyrax_dev.rake +1 -3
- data/template.rb +1 -1
- metadata +49 -41
- data/app/assets/javascripts/hyrax/collections_forms.js +0 -108
@@ -23,6 +23,7 @@ RSpec.describe Hyrax::CollectionType, type: :model do
|
|
23
23
|
|
24
24
|
it "has configuration properties with defaults" do
|
25
25
|
expect(collection_type).to be_nestable
|
26
|
+
expect(collection_type).to be_brandable
|
26
27
|
expect(collection_type).to be_discoverable
|
27
28
|
expect(collection_type).to be_sharable
|
28
29
|
expect(collection_type).to be_share_applies_to_new_works
|
@@ -32,6 +32,7 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
32
32
|
subject { presenter }
|
33
33
|
|
34
34
|
it { is_expected.to delegate_method(:collection_type_is_nestable?).to(:collection_type).as(:nestable?) }
|
35
|
+
it { is_expected.to delegate_method(:collection_type_is_brandable?).to(:collection_type).as(:brandable?) }
|
35
36
|
it { is_expected.to delegate_method(:collection_type_is_discoverable?).to(:collection_type).as(:discoverable?) }
|
36
37
|
it { is_expected.to delegate_method(:collection_type_is_sharable?).to(:collection_type).as(:sharable?) }
|
37
38
|
it { is_expected.to delegate_method(:collection_type_is_share_applies_to_new_works?).to(:collection_type).as(:share_applies_to_new_works?) }
|
@@ -321,106 +322,6 @@ RSpec.describe Hyrax::CollectionPresenter do
|
|
321
322
|
end
|
322
323
|
end
|
323
324
|
|
324
|
-
describe "#more_parent_collections?" do
|
325
|
-
subject { presenter.more_parent_collections? }
|
326
|
-
|
327
|
-
context('when parent_collections is has no collections') do
|
328
|
-
before do
|
329
|
-
allow(presenter).to receive(:parent_collection_count).and_return(0)
|
330
|
-
end
|
331
|
-
|
332
|
-
it { is_expected.to eq false }
|
333
|
-
end
|
334
|
-
|
335
|
-
context('when parent_collections has less than or equal to show limit') do
|
336
|
-
before do
|
337
|
-
allow(presenter).to receive(:parent_collection_count).and_return(3)
|
338
|
-
end
|
339
|
-
|
340
|
-
it { is_expected.to eq false }
|
341
|
-
end
|
342
|
-
|
343
|
-
context('when parent_collections has more than show limit') do
|
344
|
-
before do
|
345
|
-
allow(presenter).to receive(:parent_collection_count).and_return(4)
|
346
|
-
end
|
347
|
-
|
348
|
-
it { is_expected.to eq true }
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
describe "#visible_parent_collections" do
|
353
|
-
subject { presenter.visible_parent_collections }
|
354
|
-
|
355
|
-
let(:collection1) { build(:collection, title: ['col1']) }
|
356
|
-
let(:collection2) { build(:collection, title: ['col2']) }
|
357
|
-
let(:collection3) { build(:collection, title: ['col3']) }
|
358
|
-
let(:collection4) { build(:collection, title: ['col4']) }
|
359
|
-
let(:collection5) { build(:collection, title: ['col5']) }
|
360
|
-
let(:parent_collections) { double(Object, documents: parent_docs, response: { "numFound" => parent_docs.size }, total_pages: 1) }
|
361
|
-
|
362
|
-
before do
|
363
|
-
presenter.parent_collections = parent_collections
|
364
|
-
end
|
365
|
-
|
366
|
-
context('when parent_collections is nil') do
|
367
|
-
let(:parent_collections) { nil }
|
368
|
-
|
369
|
-
it { is_expected.to eq [] }
|
370
|
-
end
|
371
|
-
|
372
|
-
context('when parent_collections has less than or equal to show limit') do
|
373
|
-
let(:parent_docs) { [collection1, collection2, collection3] }
|
374
|
-
|
375
|
-
it { is_expected.to include(collection1, collection2, collection3) }
|
376
|
-
end
|
377
|
-
|
378
|
-
context('when parent_collections has more than show limit') do
|
379
|
-
let(:parent_docs) { [collection1, collection2, collection3, collection4, collection5] }
|
380
|
-
|
381
|
-
it { is_expected.to include(collection1, collection2, collection3) }
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
describe "#more_parent_collections" do
|
386
|
-
subject { presenter.more_parent_collections }
|
387
|
-
|
388
|
-
let(:collection1) { build(:collection, title: ['col1']) }
|
389
|
-
let(:collection2) { build(:collection, title: ['col2']) }
|
390
|
-
let(:collection3) { build(:collection, title: ['col3']) }
|
391
|
-
let(:collection4) { build(:collection, title: ['col4']) }
|
392
|
-
let(:collection5) { build(:collection, title: ['col5']) }
|
393
|
-
let(:parent_collections) { double(Object, documents: parent_docs, response: { "numFound" => parent_docs.size }, total_pages: 1) }
|
394
|
-
|
395
|
-
before do
|
396
|
-
presenter.parent_collections = parent_collections
|
397
|
-
end
|
398
|
-
|
399
|
-
context('when parent_collections is nil') do
|
400
|
-
let(:parent_collections) { nil }
|
401
|
-
|
402
|
-
it { is_expected.to eq [] }
|
403
|
-
end
|
404
|
-
|
405
|
-
context('when parent_collections is empty') do
|
406
|
-
let(:parent_docs) { [] }
|
407
|
-
|
408
|
-
it { is_expected.to eq [] }
|
409
|
-
end
|
410
|
-
|
411
|
-
context('when parent_collections has less than or equal to show limit') do
|
412
|
-
let(:parent_docs) { [collection1, collection2, collection3] }
|
413
|
-
|
414
|
-
it { is_expected.to eq [] }
|
415
|
-
end
|
416
|
-
|
417
|
-
context('when parent_collections has more than show limit') do
|
418
|
-
let(:parent_docs) { [collection1, collection2, collection3, collection4, collection5] }
|
419
|
-
|
420
|
-
it { is_expected.to include(collection4, collection5) }
|
421
|
-
end
|
422
|
-
end
|
423
|
-
|
424
325
|
describe "#user_can_nest_collection?" do
|
425
326
|
before do
|
426
327
|
allow(ability).to receive(:can?).with(:deposit, solr_doc).and_return(true)
|
@@ -20,7 +20,7 @@ RSpec.describe Hyrax::FileSetPresenter do
|
|
20
20
|
# https://github.com/samvera/active_fedora/issues/1251
|
21
21
|
allow(file).to receive(:persisted?).and_return(true)
|
22
22
|
end
|
23
|
-
it { expect(presenter.stats_path).to eq Hyrax::Engine.routes.url_helpers.stats_file_path(id: file) }
|
23
|
+
it { expect(presenter.stats_path).to eq Hyrax::Engine.routes.url_helpers.stats_file_path(id: file, locale: 'en') }
|
24
24
|
end
|
25
25
|
|
26
26
|
subject { presenter }
|
@@ -284,8 +284,13 @@ RSpec.describe Hyrax::FileSetPresenter do
|
|
284
284
|
let(:file_set) { create(:file_set) }
|
285
285
|
let(:solr_document) { SolrDocument.new(file_set.to_solr) }
|
286
286
|
let(:request) { double(base_url: 'http://test.host') }
|
287
|
-
let(:presenter) { described_class.new(solr_document,
|
287
|
+
let(:presenter) { described_class.new(solr_document, ability, request) }
|
288
288
|
let(:id) { CGI.escape(file_set.original_file.id) }
|
289
|
+
let(:read_permission) { true }
|
290
|
+
|
291
|
+
before do
|
292
|
+
allow(ability).to receive(:can?).with(:read, solr_document.id).and_return(read_permission)
|
293
|
+
end
|
289
294
|
|
290
295
|
describe "#display_image" do
|
291
296
|
subject { presenter.display_image }
|
@@ -311,6 +316,10 @@ RSpec.describe Hyrax::FileSetPresenter do
|
|
311
316
|
context "when the file is an image" do
|
312
317
|
let(:file_path) { File.open(fixture_path + '/world.png') }
|
313
318
|
|
319
|
+
before do
|
320
|
+
allow(solr_document).to receive(:image?).and_return(true)
|
321
|
+
end
|
322
|
+
|
314
323
|
it { is_expected.to be_instance_of IIIFManifest::DisplayImage }
|
315
324
|
its(:url) { is_expected.to eq "http://test.host/images/#{id}/full/600,/0/default.jpg" }
|
316
325
|
|
@@ -344,6 +353,12 @@ RSpec.describe Hyrax::FileSetPresenter do
|
|
344
353
|
it { is_expected.to be_instance_of IIIFManifest::DisplayImage }
|
345
354
|
its(:url) { is_expected.to eq "http://test.host/downloads/#{id.split('/').first}" }
|
346
355
|
end
|
356
|
+
|
357
|
+
context "when the user doesn't have permission to view the image" do
|
358
|
+
let(:read_permission) { false }
|
359
|
+
|
360
|
+
it { is_expected.to be_nil }
|
361
|
+
end
|
347
362
|
end
|
348
363
|
end
|
349
364
|
end
|
@@ -79,6 +79,12 @@ RSpec.describe Hyrax::MenuPresenter do
|
|
79
79
|
|
80
80
|
it { is_expected.to be false }
|
81
81
|
end
|
82
|
+
|
83
|
+
context "for the Hyrax::DepositorsController" do
|
84
|
+
let(:controller) { Hyrax::DepositorsController.new }
|
85
|
+
|
86
|
+
it { is_expected.to be true }
|
87
|
+
end
|
82
88
|
end
|
83
89
|
|
84
90
|
describe "#show_configuration?" do
|
@@ -11,7 +11,7 @@ RSpec.describe Hyrax::WorkShowPresenter do
|
|
11
11
|
"date_created_tesim" => ['an unformatted date'],
|
12
12
|
"depositor_tesim" => user_key }
|
13
13
|
end
|
14
|
-
let(:ability) {
|
14
|
+
let(:ability) { double Ability }
|
15
15
|
let(:presenter) { described_class.new(solr_document, ability, request) }
|
16
16
|
|
17
17
|
subject { described_class.new(double, double) }
|
@@ -48,10 +48,16 @@ RSpec.describe Hyrax::WorkShowPresenter do
|
|
48
48
|
let(:representative_presenter) { double('representative', present?: false) }
|
49
49
|
let(:image_boolean) { false }
|
50
50
|
let(:iiif_enabled) { false }
|
51
|
+
let(:file_set_presenter) { Hyrax::FileSetPresenter.new(solr_document, ability) }
|
52
|
+
let(:file_set_presenters) { [file_set_presenter] }
|
53
|
+
let(:read_permission) { true }
|
51
54
|
|
52
55
|
before do
|
53
56
|
allow(presenter).to receive(:representative_id).and_return(id_present)
|
54
57
|
allow(presenter).to receive(:representative_presenter).and_return(representative_presenter)
|
58
|
+
allow(presenter).to receive(:file_set_presenters).and_return(file_set_presenters)
|
59
|
+
allow(file_set_presenter).to receive(:image?).and_return(true)
|
60
|
+
allow(ability).to receive(:can?).with(:read, solr_document.id).and_return(read_permission)
|
55
61
|
allow(representative_presenter).to receive(:image?).and_return(image_boolean)
|
56
62
|
allow(Hyrax.config).to receive(:iiif_image_server?).and_return(iiif_enabled)
|
57
63
|
end
|
@@ -92,6 +98,12 @@ RSpec.describe Hyrax::WorkShowPresenter do
|
|
92
98
|
let(:iiif_enabled) { true }
|
93
99
|
|
94
100
|
it { is_expected.to be true }
|
101
|
+
|
102
|
+
context "when the user doesn't have permission to view the image" do
|
103
|
+
let(:read_permission) { false }
|
104
|
+
|
105
|
+
it { is_expected.to be false }
|
106
|
+
end
|
95
107
|
end
|
96
108
|
end
|
97
109
|
|
@@ -106,7 +118,7 @@ RSpec.describe Hyrax::WorkShowPresenter do
|
|
106
118
|
allow(work).to receive(:persisted?).and_return(true)
|
107
119
|
end
|
108
120
|
|
109
|
-
it { expect(presenter.stats_path).to eq Hyrax::Engine.routes.url_helpers.stats_work_path(id: work) }
|
121
|
+
it { expect(presenter.stats_path).to eq Hyrax::Engine.routes.url_helpers.stats_work_path(id: work, locale: 'en') }
|
110
122
|
end
|
111
123
|
|
112
124
|
describe '#itemtype' do
|
@@ -300,7 +312,7 @@ RSpec.describe Hyrax::WorkShowPresenter do
|
|
300
312
|
describe '#page_title' do
|
301
313
|
subject { presenter.page_title }
|
302
314
|
|
303
|
-
it { is_expected.to eq 'foo' }
|
315
|
+
it { is_expected.to eq 'Generic Work | foo | ID: 888888 | Hyrax' }
|
304
316
|
end
|
305
317
|
|
306
318
|
describe "#valid_child_concerns" do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
RSpec.describe Hyrax::AbstractTypeRelation, :clean_repo do
|
2
|
+
before do
|
3
|
+
stub_const 'AnotherWork', Class.new
|
4
|
+
end
|
5
|
+
it 'returns nil when no allowable types exist' do
|
6
|
+
allow(subject).to receive(:allowable_types).and_return([])
|
7
|
+
expect(subject.search_model_clause).to be_nil
|
8
|
+
end
|
9
|
+
it 'returns GenericWork when allowable types exist' do
|
10
|
+
allow(subject).to receive(:allowable_types).and_return([GenericWork])
|
11
|
+
expect(subject.search_model_clause).to include('GenericWork')
|
12
|
+
end
|
13
|
+
it 'returns both works when allowable types exist' do
|
14
|
+
allow(subject).to receive(:allowable_types).and_return([GenericWork, AnotherWork])
|
15
|
+
expect(subject.search_model_clause).to include('GenericWork')
|
16
|
+
expect(subject.search_model_clause).to include('AnotherWork')
|
17
|
+
end
|
18
|
+
end
|
@@ -7,7 +7,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsSearchBuilder do
|
|
7
7
|
let(:ability) do
|
8
8
|
::Ability.new(user)
|
9
9
|
end
|
10
|
-
let(:user) {
|
10
|
+
let(:user) { build(:user, groups: 'registered') }
|
11
11
|
let(:builder) { described_class.new(context) }
|
12
12
|
|
13
13
|
describe '#models' do
|
@@ -49,37 +49,40 @@ RSpec.describe Hyrax::Dashboard::CollectionsSearchBuilder do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "#gated_discovery_filters" do
|
52
|
+
let(:user2) { build(:user) }
|
53
|
+
let!(:collection) { build(:collection_lw, user: user2, with_permission_template: permissions, with_solr_document: true) }
|
54
|
+
|
52
55
|
subject { builder.gated_discovery_filters }
|
53
56
|
|
54
|
-
|
55
|
-
|
57
|
+
context "user has manage access" do
|
58
|
+
let(:permissions) { { manage_users: [user] } }
|
59
|
+
|
60
|
+
it { is_expected.to include ["{!terms f=id}#{collection.id}"] }
|
61
|
+
end
|
56
62
|
|
57
63
|
context "user has deposit access" do
|
58
|
-
|
59
|
-
create(:permission_template_access,
|
60
|
-
permission_template: permission_template,
|
61
|
-
agent_type: 'user',
|
62
|
-
agent_id: user.user_key,
|
63
|
-
access: 'deposit')
|
64
|
-
end
|
64
|
+
let(:permissions) { { deposit_users: [user] } }
|
65
65
|
|
66
66
|
it { is_expected.to include ["{!terms f=id}#{collection.id}"] }
|
67
67
|
end
|
68
68
|
|
69
|
-
context "
|
70
|
-
|
71
|
-
create(:permission_template_access,
|
72
|
-
permission_template: permission_template,
|
73
|
-
agent_type: 'group',
|
74
|
-
agent_id: 'registered',
|
75
|
-
access: 'deposit')
|
76
|
-
end
|
69
|
+
context "user has view access" do
|
70
|
+
let(:permissions) { { view_users: [user] } }
|
77
71
|
|
78
|
-
it { is_expected.
|
72
|
+
it { is_expected.not_to include ["{!terms f=id}#{collection.id}"] }
|
73
|
+
end
|
74
|
+
|
75
|
+
context "does not include registered group for read access" do
|
76
|
+
let(:permissions) { { view_groups: ['registered'] } }
|
77
|
+
|
78
|
+
it { is_expected.not_to include ["{!terms f=id}#{collection.id}"] }
|
79
79
|
end
|
80
80
|
|
81
81
|
context "does not include public group for read access" do
|
82
|
+
let(:permissions) { { view_groups: ['public'] } }
|
83
|
+
|
82
84
|
let(:expected_discovery_filters) do
|
85
|
+
# all filters except no additional ids added for deposit collections
|
83
86
|
[
|
84
87
|
["({!terms f=edit_access_group_ssim}public,registered)"],
|
85
88
|
["edit_access_person_ssim:#{user.user_key}", "read_access_person_ssim:#{user.user_key}"]
|
@@ -88,5 +91,13 @@ RSpec.describe Hyrax::Dashboard::CollectionsSearchBuilder do
|
|
88
91
|
|
89
92
|
it { is_expected.to eq expected_discovery_filters }
|
90
93
|
end
|
94
|
+
|
95
|
+
context "user has deposit access and registered has deposit access" do
|
96
|
+
# make sure that having registered deposit access, which isn't included, doesn't
|
97
|
+
# remove the user specific deposit access
|
98
|
+
let(:permissions) { { deposit_users: [user], view_groups: ['registered'] } }
|
99
|
+
|
100
|
+
it { is_expected.to include ["{!terms f=id}#{collection.id}"] }
|
101
|
+
end
|
91
102
|
end
|
92
103
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.describe Hyrax::ParentCollectionSearchBuilder do
|
2
|
+
let(:solr_params) { { fq: [] } }
|
3
|
+
let(:item) { double(id: '12345', member_of_collection_ids: ['col1']) }
|
4
|
+
let(:builder) { described_class.new(solr_params, context) }
|
5
|
+
let(:context) { double("context", blacklight_config: CatalogController.blacklight_config, item: item) }
|
6
|
+
|
7
|
+
describe '#include_item_ids' do
|
8
|
+
let(:subject) { builder.include_item_ids(solr_params) }
|
9
|
+
|
10
|
+
it 'updates solr_parameters[:fq]' do
|
11
|
+
subject
|
12
|
+
expect(solr_params[:fq]).to include("{!terms f=id}col1")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,28 +1,19 @@
|
|
1
1
|
RSpec.describe Hyrax::CollectionMemberService, :clean_repo do
|
2
|
-
let(:
|
3
|
-
|
4
|
-
let(:
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
|
2
|
+
let(:user) { create(:user, groups: 'potato') }
|
3
|
+
let!(:ability) { ::Ability.new(user) }
|
4
|
+
let!(:col1) { build(:collection_lw, id: 'col1', user: user, with_solr_document: true) }
|
5
|
+
let!(:col2) { build(:collection_lw, id: 'col2', with_solr_document: true) }
|
6
|
+
let(:colls) { [col1.id, col2.id] }
|
7
|
+
let(:work_attrs) { { id: '123', title_tesim: ['A generic work'], member_of_collection_ids_ssim: colls } }
|
8
8
|
let(:work) { SolrDocument.new(work_attrs) }
|
9
9
|
|
10
|
-
before do
|
11
|
-
ActiveFedora::SolrService.add(coll1_attrs)
|
12
|
-
ActiveFedora::SolrService.add(coll2_attrs)
|
13
|
-
ActiveFedora::SolrService.add(coll3_attrs)
|
14
|
-
ActiveFedora::SolrService.commit
|
15
|
-
end
|
16
|
-
|
17
10
|
describe "#run" do
|
18
|
-
subject { described_class.run(work) }
|
11
|
+
subject { described_class.run(work, ability) }
|
19
12
|
|
20
|
-
|
21
|
-
expect(subject.
|
13
|
+
it "returns only authorized parent collections" do
|
14
|
+
expect(subject.count).to eq(1)
|
22
15
|
ids = subject.map { |col| col[:id] }
|
23
|
-
expect(ids).to
|
24
|
-
expect(ids).to include(coll2_attrs[:id])
|
25
|
-
expect(ids).not_to include(coll3_attrs[:id])
|
16
|
+
expect(ids).to contain_exactly(col1.id)
|
26
17
|
end
|
27
18
|
end
|
28
19
|
end
|
@@ -8,6 +8,7 @@ RSpec.describe Hyrax::CollectionTypes::CreateService do
|
|
8
8
|
expect(ct.description).to eq('')
|
9
9
|
expect(ct).to be_nestable
|
10
10
|
expect(ct).to be_discoverable
|
11
|
+
expect(ct).to be_brandable
|
11
12
|
expect(ct).to be_sharable
|
12
13
|
expect(ct).to be_share_applies_to_new_works
|
13
14
|
expect(ct).to be_allow_multiple_membership
|
@@ -42,6 +43,7 @@ RSpec.describe Hyrax::CollectionTypes::CreateService do
|
|
42
43
|
expect(ct.title).to eq(Hyrax::CollectionType::ADMIN_SET_DEFAULT_TITLE)
|
43
44
|
expect(ct.description).to eq('An aggregation of works that is intended to help with administrative control. Admin Sets provide a way of defining behaviors and policies around a set of works.')
|
44
45
|
expect(ct).not_to be_nestable
|
46
|
+
expect(ct).not_to be_brandable
|
45
47
|
expect(ct).not_to be_discoverable
|
46
48
|
expect(ct).to be_sharable
|
47
49
|
expect(ct).to be_share_applies_to_new_works
|
@@ -60,6 +62,7 @@ RSpec.describe Hyrax::CollectionTypes::CreateService do
|
|
60
62
|
expect(ct.title).to eq(Hyrax::CollectionType::USER_COLLECTION_DEFAULT_TITLE)
|
61
63
|
expect(ct.description).to eq('A User Collection can be created by any user to organize their works.')
|
62
64
|
expect(ct).to be_nestable
|
65
|
+
expect(ct).to be_brandable
|
63
66
|
expect(ct).to be_discoverable
|
64
67
|
expect(ct).to be_sharable
|
65
68
|
expect(ct).not_to be_share_applies_to_new_works
|
@@ -84,8 +87,38 @@ RSpec.describe Hyrax::CollectionTypes::CreateService do
|
|
84
87
|
let(:coltype) { create(:collection_type) }
|
85
88
|
|
86
89
|
it 'adds the participants to a collection type' do
|
87
|
-
expect(
|
88
|
-
|
90
|
+
expect { described_class.add_participants(coltype.id, participants) }
|
91
|
+
.to change { Hyrax::CollectionType.find(coltype.id).collection_type_participants.to_a }
|
92
|
+
.to contain_exactly an_object_having_attributes(**participants.first)
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'when participants are incomplete' do
|
96
|
+
let(:participants) do
|
97
|
+
[{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE,
|
98
|
+
agent_id: 'test_group',
|
99
|
+
access: Hyrax::CollectionTypeParticipant::MANAGE_ACCESS },
|
100
|
+
{ agent_type: Hyrax::CollectionTypeParticipant::GROUP_TYPE,
|
101
|
+
agent_id: 'test_group' }]
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'logs and raises an error' do
|
105
|
+
expect(Rails.logger)
|
106
|
+
.to receive(:error)
|
107
|
+
.with a_string_starting_with('Participants not created')
|
108
|
+
|
109
|
+
expect { described_class.add_participants(coltype.id, participants) }
|
110
|
+
.to raise_error(described_class::InvalidParticipantError)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'does not add participants' do
|
114
|
+
expect do
|
115
|
+
begin
|
116
|
+
described_class.add_participants(coltype.id, participants)
|
117
|
+
rescue described_class::InvalidParticipantError
|
118
|
+
nil
|
119
|
+
end
|
120
|
+
end.not_to change { Hyrax::CollectionType.find(coltype.id).collection_type_participants.to_a }
|
121
|
+
end
|
89
122
|
end
|
90
123
|
end
|
91
124
|
end
|