curation_concerns 0.1.0
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +15 -0
- data/README.md +46 -0
- data/RELEASING.md +2 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/application.js +18 -0
- data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
- data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
- data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
- data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
- data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
- data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
- data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
- data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
- data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
- data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
- data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
- data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
- data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
- data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
- data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
- data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
- data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
- data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
- data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
- data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
- data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +3 -0
- data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
- data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
- data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
- data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
- data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
- data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
- data/app/controllers/curation_concerns/application_controller.rb +7 -0
- data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
- data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
- data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +5 -0
- data/app/controllers/leases_controller.rb +5 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
- data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
- data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
- data/app/helpers/curation_concerns/ability_helper.rb +46 -0
- data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
- data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
- data/app/helpers/curation_concerns/collections_helper.rb +63 -0
- data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
- data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
- data/app/helpers/curation_concerns/lease_helper.rb +18 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
- data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
- data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
- data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
- data/app/helpers/curation_concerns/title_helper.rb +23 -0
- data/app/helpers/curation_concerns/url_helper.rb +29 -0
- data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
- data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
- data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
- data/app/search_builders/curation_concerns/search_builder.rb +49 -0
- data/app/services/curation_concerns/curation_concern.rb +14 -0
- data/app/services/curation_concerns/embargo_service.rb +26 -0
- data/app/services/curation_concerns/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +47 -0
- data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_additional_information.html.erb +6 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_representative_image.html.erb +13 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_form_to_add_member.html.erb +21 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +17 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
- data/app/views/curation_concerns/base/_collections.html.erb +26 -0
- data/app/views/curation_concerns/base/_form.html.erb +25 -0
- data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
- data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
- data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
- data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
- data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
- data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concerns/base/edit.html.erb +13 -0
- data/app/views/curation_concerns/base/new.html.erb +12 -0
- data/app/views/curation_concerns/base/show.html.erb +21 -0
- data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
- data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
- data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
- data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
- data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
- data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
- data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
- data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
- data/app/views/layouts/curation_concerns.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/workers/visibility_copy_worker.rb +30 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/curation_concerns.en.yml +96 -0
- data/config/routes.rb +4 -0
- data/curation_concerns-models/.gitignore +17 -0
- data/curation_concerns-models/Gemfile +4 -0
- data/curation_concerns-models/LICENSE.md +177 -0
- data/curation_concerns-models/README.md +42 -0
- data/curation_concerns-models/Rakefile +1 -0
- data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
- data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
- data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
- data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
- data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
- data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
- data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
- data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
- data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
- data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
- data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
- data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
- data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
- data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
- data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
- data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
- data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
- data/curation_concerns-models/app/models/version_committer.rb +2 -0
- data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
- data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
- data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
- data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
- data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
- data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
- data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
- data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
- data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
- data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
- data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
- data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
- data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
- data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
- data/curation_concerns-models/lib/tasks/resque.rake +13 -0
- data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
- data/curation_concerns.gemspec +46 -0
- data/lib/curation_concerns/configuration.rb +74 -0
- data/lib/curation_concerns/controller_resource.rb +10 -0
- data/lib/curation_concerns/engine.rb +20 -0
- data/lib/curation_concerns/rails/routes.rb +76 -0
- data/lib/curation_concerns/spec_support.rb +10 -0
- data/lib/curation_concerns/version.rb +3 -0
- data/lib/curation_concerns.rb +8 -0
- data/lib/generators/curation_concerns/install_generator.rb +103 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
- data/lib/generators/curation_concerns/work/USAGE +19 -0
- data/lib/generators/curation_concerns/work/templates/README +13 -0
- data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
- data/solr_conf/conf/solrconfig.xml +223 -0
- data/spec/abilities/collection_abilities_spec.rb +48 -0
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
- data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
- data/spec/controllers/catalog_controller_spec.rb +115 -0
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
- data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +51 -0
- data/spec/controllers/embargoes_controller_spec.rb +114 -0
- data/spec/controllers/leases_controller_spec.rb +94 -0
- data/spec/factories/collections.rb +15 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +31 -0
- data/spec/factories/generic_works.rb +54 -0
- data/spec/factories/users.rb +28 -0
- data/spec/features/add_file_spec.rb +30 -0
- data/spec/features/collection_spec.rb +222 -0
- data/spec/features/create_work_spec.rb +43 -0
- data/spec/features/embargo_spec.rb +51 -0
- data/spec/features/lease_spec.rb +49 -0
- data/spec/features/update_file_spec.rb +32 -0
- data/spec/features/work_generator_spec.rb +58 -0
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/charter.docx +0 -0
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/fixtures/image.jp2 +0 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sample_mpeg4.mp4 +0 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/fixtures/spoken-text.m4a +0 -0
- data/spec/fixtures/test4.pdf +0 -0
- data/spec/fixtures/test5.mp3 +0 -0
- data/spec/fixtures/world.png +0 -0
- data/spec/forms/collection_edit_form_spec.rb +20 -0
- data/spec/forms/generic_file_edit_form_spec.rb +33 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/curation_concerns/.keep +0 -0
- data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +22 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
- data/spec/jobs/audit_job_spec.rb +53 -0
- data/spec/jobs/characterize_job_spec.rb +23 -0
- data/spec/jobs/copy_permissions_job_spec.rb +49 -0
- data/spec/jobs/create_derivatives_job_spec.rb +23 -0
- data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
- data/spec/jobs/import_url_job_spec.rb +45 -0
- data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
- data/spec/lib/curation_concerns/messages_spec.rb +70 -0
- data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
- data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/matchers/response_matchers.rb +7 -0
- data/spec/matchers.rb +24 -0
- data/spec/models/checksum_audit_log_spec.rb +66 -0
- data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
- data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
- data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
- data/spec/models/fits_datastream_spec.rb +127 -0
- data/spec/models/generic_file_spec.rb +619 -0
- data/spec/models/generic_work_spec.rb +43 -0
- data/spec/models/user_spec.rb +23 -0
- data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
- data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
- data/spec/routing/curation_concerns/routes_spec.rb +36 -0
- data/spec/routing/route_spec.rb +86 -0
- data/spec/services/characterization_service_spec.rb +30 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/full_text_extraction_service_spec.rb +5 -0
- data/spec/services/generic_file_audit_service_spec.rb +71 -0
- data/spec/services/generic_file_indexing_service_spec.rb +57 -0
- data/spec/services/generic_work_indexing_service_spec.rb +18 -0
- data/spec/services/lease_service_spec.rb +53 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/services/versioning_service_spec.rb +32 -0
- data/spec/spec_helper.rb +94 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concerns/factory_helpers.rb +14 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/tasks/rake_spec.rb +24 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
- data/spec/views/catalog/index.html.erb_spec.rb +59 -0
- data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +70 -0
- data/tasks/jetty.rake +15 -0
- data/tasks/release.rake +93 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- metadata +888 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require "cancan/matchers"
|
|
3
|
+
|
|
4
|
+
describe "User" do
|
|
5
|
+
describe "Abilities" do
|
|
6
|
+
subject { Ability.new(current_user) }
|
|
7
|
+
|
|
8
|
+
let(:generic_work) { FactoryGirl.create(:private_generic_work, user: creating_user ) }
|
|
9
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
10
|
+
|
|
11
|
+
describe 'without embargo' do
|
|
12
|
+
describe 'creator of object' do
|
|
13
|
+
let(:creating_user) { user }
|
|
14
|
+
let(:current_user) { user }
|
|
15
|
+
it {
|
|
16
|
+
should be_able_to(:create, GenericWork.new)
|
|
17
|
+
should be_able_to(:read, generic_work)
|
|
18
|
+
should be_able_to(:update, generic_work)
|
|
19
|
+
should be_able_to(:destroy, generic_work)
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe 'as a repository manager' do
|
|
24
|
+
let(:manager_user) { FactoryGirl.create(:admin) }
|
|
25
|
+
let(:creating_user) { user }
|
|
26
|
+
let(:current_user) { manager_user }
|
|
27
|
+
it {
|
|
28
|
+
should be_able_to(:create, GenericWork.new)
|
|
29
|
+
should be_able_to(:read, generic_work)
|
|
30
|
+
should be_able_to(:update, generic_work)
|
|
31
|
+
should be_able_to(:destroy, generic_work)
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'another authenticated user' do
|
|
36
|
+
let(:creating_user) { FactoryGirl.create(:user) }
|
|
37
|
+
let(:current_user) { user }
|
|
38
|
+
it {
|
|
39
|
+
should be_able_to(:create, GenericWork.new)
|
|
40
|
+
should_not be_able_to(:read, generic_work)
|
|
41
|
+
should_not be_able_to(:update, generic_work)
|
|
42
|
+
should_not be_able_to(:destroy, generic_work)
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe 'a nil user' do
|
|
47
|
+
let(:creating_user) { FactoryGirl.create(:user) }
|
|
48
|
+
let(:current_user) { nil }
|
|
49
|
+
it {
|
|
50
|
+
should_not be_able_to(:create, GenericWork.new)
|
|
51
|
+
should_not be_able_to(:read, generic_work)
|
|
52
|
+
should_not be_able_to(:update, generic_work)
|
|
53
|
+
should_not be_able_to(:destroy, generic_work)
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericFileActor do
|
|
4
|
+
include ActionDispatch::TestProcess
|
|
5
|
+
|
|
6
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
7
|
+
let(:generic_file) { FactoryGirl.create(:generic_file) }
|
|
8
|
+
let(:actor) { CurationConcerns::GenericFileActor.new(generic_file, user) }
|
|
9
|
+
let(:uploaded_file) { fixture_file_upload('/world.png','image/png') }
|
|
10
|
+
|
|
11
|
+
describe "creating metadata and content" do
|
|
12
|
+
let(:batch_id) { nil }
|
|
13
|
+
let(:work_id) { nil }
|
|
14
|
+
subject { generic_file.reload }
|
|
15
|
+
before do
|
|
16
|
+
allow(actor).to receive(:save_characterize_and_record_committer).and_return("true")
|
|
17
|
+
actor.create_metadata(batch_id, work_id)
|
|
18
|
+
actor.create_content(uploaded_file)
|
|
19
|
+
end
|
|
20
|
+
context "when a work_id is provided" do
|
|
21
|
+
let(:work) { FactoryGirl.create(:generic_work) }
|
|
22
|
+
let(:work_id) { work.id }
|
|
23
|
+
it "adds the generic file to the parent work" do
|
|
24
|
+
expect(subject.generic_works).to eq [work]
|
|
25
|
+
expect(work.reload.generic_files).to include(subject)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "#create_content" do
|
|
31
|
+
let(:deposit_message) { double('deposit message') }
|
|
32
|
+
let(:characterize_message) { double('characterize message') }
|
|
33
|
+
before do
|
|
34
|
+
allow(CurationConcerns.queue).to receive(:push)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "uses the provided mime_type" do
|
|
38
|
+
actor.create_content(uploaded_file)
|
|
39
|
+
expect(generic_file.original_file.mime_type).to eq "image/png"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context "when generic_file.title is empty and generic_file.label is not" do
|
|
43
|
+
let(:file) { "world.png" }
|
|
44
|
+
let(:long_name) { "an absurdly long title that goes on way to long and messes up the display of the page which should not need to be this big in order to show this impossibly long, long, long, oh so long string" }
|
|
45
|
+
let(:short_name) { "Nice Short Name" }
|
|
46
|
+
let(:actor) { CurationConcerns::GenericFileActor.new(generic_file, user) }
|
|
47
|
+
before do
|
|
48
|
+
allow(generic_file).to receive(:label).and_return(short_name)
|
|
49
|
+
allow(CurationConcerns.queue).to receive(:push)
|
|
50
|
+
actor.create_content(fixture_file_upload(file))
|
|
51
|
+
end
|
|
52
|
+
subject { generic_file.title }
|
|
53
|
+
it { is_expected.to eql [short_name] }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context "with two existing versions from different users" do
|
|
57
|
+
|
|
58
|
+
let(:file1) { "world.png" }
|
|
59
|
+
let(:file2) { "small_file.txt" }
|
|
60
|
+
let(:actor1) { CurationConcerns::GenericFileActor.new(generic_file, user) }
|
|
61
|
+
let(:actor2) { CurationConcerns::GenericFileActor.new(generic_file, second_user) }
|
|
62
|
+
|
|
63
|
+
let(:second_user) { FactoryGirl.find_or_create(:archivist) }
|
|
64
|
+
let(:versions) { generic_file.original_file.versions }
|
|
65
|
+
|
|
66
|
+
before do
|
|
67
|
+
allow(CurationConcerns.queue).to receive(:push)
|
|
68
|
+
actor1.create_content(fixture_file_upload(file1))
|
|
69
|
+
actor2.create_content(fixture_file_upload(file2))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should have two versions" do
|
|
73
|
+
expect(versions.all.count).to eq 2
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should have the current version" do
|
|
77
|
+
expect(CurationConcerns::VersioningService.latest_version_of(generic_file.original_file).label).to eq 'version2'
|
|
78
|
+
expect(generic_file.original_file.content).to eq fixture_file_upload(file2).read
|
|
79
|
+
expect(generic_file.original_file.mime_type).to eq "text/plain"
|
|
80
|
+
expect(generic_file.original_file.original_name).to eq file2
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "should use the first version for the object's title and label" do
|
|
84
|
+
expect(generic_file.label).to eql(file1)
|
|
85
|
+
expect(generic_file.title.first).to eql(file1)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should note the user for each version" do
|
|
89
|
+
expect(VersionCommitter.where(version_id: versions.first.uri).pluck(:committer_login)).to eq [user.user_key]
|
|
90
|
+
expect(VersionCommitter.where(version_id: versions.last.uri).pluck(:committer_login)).to eq [second_user.user_key]
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context "when a label is already specified" do
|
|
96
|
+
let(:label) { "test_file.png" }
|
|
97
|
+
let(:new_file) { "foo.jpg" }
|
|
98
|
+
let(:generic_file_with_label) do
|
|
99
|
+
GenericFile.new.tap do |f|
|
|
100
|
+
f.apply_depositor_metadata(user.user_key)
|
|
101
|
+
f.label = label
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
let(:actor) { CurationConcerns::GenericFileActor.new(generic_file_with_label, user)}
|
|
105
|
+
|
|
106
|
+
before do
|
|
107
|
+
allow(actor).to receive(:save_characterize_and_record_committer).and_return("true")
|
|
108
|
+
allow(Hydra::Works::UploadFileToGenericFile).to receive(:call)
|
|
109
|
+
actor.create_content(Tempfile.new(new_file))
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
it "will retain the object's original label" do
|
|
113
|
+
expect(generic_file_with_label.label).to eql(label)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
describe CurationConcerns::ManagesEmbargoesActor do
|
|
3
|
+
|
|
4
|
+
let(:model) {
|
|
5
|
+
Class.new(CurationConcerns::BaseActor) {
|
|
6
|
+
include CurationConcerns::ManagesEmbargoesActor
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let(:user) { User.new }
|
|
11
|
+
let(:curation_concern) { GenericWork.new }
|
|
12
|
+
let(:attributes) {{}}
|
|
13
|
+
subject {
|
|
14
|
+
model.new(curation_concern, user, attributes)
|
|
15
|
+
}
|
|
16
|
+
let(:date) { Date.today+2 }
|
|
17
|
+
|
|
18
|
+
context "#interpret_visibility" do
|
|
19
|
+
it "should interpret lease and embargo visibility" do
|
|
20
|
+
expect(subject).to receive(:interpret_lease_visibility).and_return(true)
|
|
21
|
+
expect(subject).to receive(:interpret_embargo_visibility).and_return(true)
|
|
22
|
+
expect(subject.interpret_visibility).to be true
|
|
23
|
+
end
|
|
24
|
+
it "should collect failures from interpreting lease & embargo visibility" do
|
|
25
|
+
expect(subject).to receive(:interpret_embargo_visibility).and_return(true)
|
|
26
|
+
expect(subject).to receive(:interpret_lease_visibility).and_return(false)
|
|
27
|
+
expect(subject.interpret_visibility).to be false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context "#interpret_embargo_visibility" do
|
|
32
|
+
context 'when visibility is not set to embargo' do
|
|
33
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
|
|
34
|
+
visibility_during_embargo: 'restricted', visibility_after_embargo: 'open' } }
|
|
35
|
+
it "removes the embargo attributes and returns true" do
|
|
36
|
+
expect(subject.interpret_embargo_visibility).to be true
|
|
37
|
+
expect(subject.attributes.keys).to eq ['visibility']
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "when visibility is set to embargo" do
|
|
42
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO,
|
|
43
|
+
visibility_during_embargo: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE,
|
|
44
|
+
visibility_after_embargo: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
|
|
45
|
+
embargo_release_date: date.to_s } }
|
|
46
|
+
|
|
47
|
+
it "should apply the embargo remove embargo attributes except for embargo_release_date and return true" do
|
|
48
|
+
expect(subject.curation_concern).to receive(:apply_embargo).with(date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE,Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)
|
|
49
|
+
expect(subject.interpret_embargo_visibility).to be true
|
|
50
|
+
expect(subject.attributes.keys).to eq ['embargo_release_date']
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "when embargo_release_date is not set" do
|
|
54
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO } }
|
|
55
|
+
it "should set error on curation_concern and return false" do
|
|
56
|
+
expect(subject.interpret_embargo_visibility).to be false
|
|
57
|
+
expect(subject.curation_concern.errors[:visibility].first).to eq 'When setting visibility to "embargo" you must also specify embargo release date.'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context "#interpret_lease_visibility" do
|
|
65
|
+
context 'when visibility is not set to lease' do
|
|
66
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
|
|
67
|
+
visibility_during_lease: 'open', visibility_after_lease: 'restricted' } }
|
|
68
|
+
it "removes the lease attributes and returns true" do
|
|
69
|
+
expect(subject.interpret_lease_visibility).to be true
|
|
70
|
+
expect(subject.attributes.keys).to eq ['visibility']
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
context "when visibility is set to lease" do
|
|
75
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE,
|
|
76
|
+
visibility_during_lease: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE,
|
|
77
|
+
visibility_after_lease: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
|
|
78
|
+
lease_expiration_date: date.to_s } }
|
|
79
|
+
|
|
80
|
+
it "should apply the lease, remove lease attributes except for lease_expiration_date and return true" do
|
|
81
|
+
expect(subject.curation_concern).to receive(:apply_lease).with(date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)
|
|
82
|
+
expect(subject.interpret_lease_visibility).to be true
|
|
83
|
+
expect(subject.attributes.keys).to eq ['lease_expiration_date']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
context "when lease_expiration_date is not set" do
|
|
87
|
+
let(:attributes) { { visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE } }
|
|
88
|
+
it "should set error on curation_concern and return false" do
|
|
89
|
+
expect(subject.interpret_lease_visibility).to be false
|
|
90
|
+
expect(subject.curation_concern.errors[:visibility].first).to eq 'When setting visibility to "lease" you must also specify lease expiration date.'
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericWorkActor do
|
|
4
|
+
include ActionDispatch::TestProcess
|
|
5
|
+
|
|
6
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
7
|
+
let(:file) { curation_concerns_fixture_file_upload('files/image.png', 'image/png') }
|
|
8
|
+
|
|
9
|
+
subject {
|
|
10
|
+
CurationConcerns::CurationConcern.actor(curation_concern, user, attributes)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe '#create' do
|
|
14
|
+
let(:curation_concern) { GenericWork.new }
|
|
15
|
+
|
|
16
|
+
context 'failure' do
|
|
17
|
+
let(:attributes) {{}}
|
|
18
|
+
|
|
19
|
+
it 'returns false' do
|
|
20
|
+
expect_any_instance_of(CurationConcerns::GenericWorkActor).to receive(:save).and_return(false)
|
|
21
|
+
allow(subject).to receive(:attach_files).and_return(true)
|
|
22
|
+
expect(subject.create).to be false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'valid attributes' do
|
|
27
|
+
let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED }
|
|
28
|
+
|
|
29
|
+
context 'with embargo' do
|
|
30
|
+
let(:attributes) { { title: ["New embargo"], visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO,
|
|
31
|
+
visibility_during_embargo: "authenticated", embargo_release_date: date.to_s,
|
|
32
|
+
visibility_after_embargo: "open", visibility_during_lease: "open",
|
|
33
|
+
lease_expiration_date: "2014-06-12", visibility_after_lease: "restricted",
|
|
34
|
+
rights: ["http://creativecommons.org/licenses/by/3.0/us/"] } }
|
|
35
|
+
|
|
36
|
+
context "with a valid embargo date" do
|
|
37
|
+
let(:date) { Date.today + 2 }
|
|
38
|
+
it "should interpret and apply embargo and lease visibility settings" do
|
|
39
|
+
subject.create
|
|
40
|
+
expect(curation_concern).to be_persisted
|
|
41
|
+
expect(curation_concern.visibility_during_embargo).to eq 'authenticated'
|
|
42
|
+
expect(curation_concern.visibility_after_embargo).to eq 'open'
|
|
43
|
+
expect(curation_concern.visibility).to eq 'authenticated'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context "when embargo_release_date is in the past" do
|
|
48
|
+
let(:date) { Date.today-2 }
|
|
49
|
+
it "should set error on curation_concern and return false" do
|
|
50
|
+
expect(subject.create).to be false
|
|
51
|
+
expect(subject.curation_concern.errors[:embargo_release_date].first).to eq 'Must be a future date'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context 'with lease' do
|
|
57
|
+
let(:attributes) { { title: ["New embargo"], visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE,
|
|
58
|
+
visibility_during_embargo: "authenticated", embargo_release_date: '2099-05-12',
|
|
59
|
+
visibility_after_embargo: "open", visibility_during_lease: "open",
|
|
60
|
+
lease_expiration_date: date.to_s, visibility_after_lease: "restricted",
|
|
61
|
+
rights: ["http://creativecommons.org/licenses/by/3.0/us/"] } }
|
|
62
|
+
|
|
63
|
+
context "with a valid lease date" do
|
|
64
|
+
let(:date) { Date.today + 2 }
|
|
65
|
+
it "should interpret and apply embargo and lease visibility settings" do
|
|
66
|
+
subject.create
|
|
67
|
+
expect(curation_concern).to be_persisted
|
|
68
|
+
expect(curation_concern.embargo_release_date).to be_nil
|
|
69
|
+
expect(curation_concern.visibility_during_lease).to eq 'open'
|
|
70
|
+
expect(curation_concern.visibility_after_lease).to eq 'restricted'
|
|
71
|
+
expect(curation_concern.visibility).to eq 'open'
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context "when lease_expiration_date is in the past" do
|
|
76
|
+
let(:date) { Date.today-2 }
|
|
77
|
+
it "should set error on curation_concern and return false" do
|
|
78
|
+
expect(subject.create).to be false
|
|
79
|
+
expect(subject.curation_concern.errors[:lease_expiration_date].first).to eq 'Must be a future date'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
context 'with a file' do
|
|
85
|
+
let(:attributes) {
|
|
86
|
+
FactoryGirl.attributes_for(:generic_work, visibility: visibility).tap {|a|
|
|
87
|
+
a[:files] = file
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
context 'authenticated visibility' do
|
|
92
|
+
it 'should stamp each file with the access rights' do
|
|
93
|
+
s2 = double('characterize job')
|
|
94
|
+
allow(CharacterizeJob).to receive(:new).and_return(s2)
|
|
95
|
+
expect(CurationConcerns.queue).to receive(:push).with(s2).once
|
|
96
|
+
expect(subject.create).to be true
|
|
97
|
+
expect(curation_concern).to be_persisted
|
|
98
|
+
expect(curation_concern.date_uploaded).to eq Date.today
|
|
99
|
+
expect(curation_concern.date_modified).to eq Date.today
|
|
100
|
+
expect(curation_concern.depositor).to eq user.user_key
|
|
101
|
+
expect(curation_concern.representative).to_not be_nil
|
|
102
|
+
expect(curation_concern.generic_files.size).to eq 1
|
|
103
|
+
# Sanity test to make sure the file we uploaded is stored and has same permission as parent.
|
|
104
|
+
generic_file = curation_concern.generic_files.first
|
|
105
|
+
file.rewind
|
|
106
|
+
expect(generic_file.original_file.content).to eq file.read
|
|
107
|
+
|
|
108
|
+
expect(curation_concern).to be_authenticated_only_access
|
|
109
|
+
expect(generic_file).to be_authenticated_only_access
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
context 'with multiple files file' do
|
|
115
|
+
let(:attributes) {
|
|
116
|
+
FactoryGirl.attributes_for(:generic_work, visibility: visibility).tap {|a|
|
|
117
|
+
a[:files] = [file, file]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
context 'authenticated visibility' do
|
|
122
|
+
it 'should stamp each file with the access rights' do
|
|
123
|
+
s2 = double('characterize job')
|
|
124
|
+
allow(CharacterizeJob).to receive(:new).and_return(s2)
|
|
125
|
+
expect(CurationConcerns.queue).to receive(:push).with(s2).twice
|
|
126
|
+
|
|
127
|
+
expect(subject.create).to be true
|
|
128
|
+
expect(curation_concern).to be_persisted
|
|
129
|
+
expect(curation_concern.date_uploaded).to eq Date.today
|
|
130
|
+
expect(curation_concern.date_modified).to eq Date.today
|
|
131
|
+
expect(curation_concern.depositor).to eq user.user_key
|
|
132
|
+
|
|
133
|
+
expect(curation_concern.generic_files.size).to eq 2
|
|
134
|
+
# Sanity test to make sure the file we uploaded is stored and has same permission as parent.
|
|
135
|
+
|
|
136
|
+
expect(curation_concern).to be_authenticated_only_access
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
context "with a present and a blank title" do
|
|
142
|
+
let(:attributes) {
|
|
143
|
+
FactoryGirl.attributes_for(:generic_work, title: ['this is present', ''])
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
it 'should stamp each link with the access rights' do
|
|
147
|
+
expect(subject.create).to be true
|
|
148
|
+
expect(curation_concern).to be_persisted
|
|
149
|
+
expect(curation_concern.title).to eq ['this is present']
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
describe '#update' do
|
|
156
|
+
let(:curation_concern) { FactoryGirl.create(:generic_work, user: user)}
|
|
157
|
+
|
|
158
|
+
context 'failure' do
|
|
159
|
+
let(:attributes) {{}}
|
|
160
|
+
|
|
161
|
+
it 'returns false' do
|
|
162
|
+
expect_any_instance_of(CurationConcerns::GenericWorkActor).to receive(:save).and_return(false)
|
|
163
|
+
expect(subject.update).to be false
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
context 'valid attributes' do
|
|
168
|
+
let(:attributes) {{}}
|
|
169
|
+
it "should interpret and apply embargo and lease visibility settings" do
|
|
170
|
+
expect(subject).to receive(:interpret_lease_visibility).and_return(true)
|
|
171
|
+
expect(subject).to receive(:interpret_embargo_visibility).and_return(true)
|
|
172
|
+
subject.update
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
context 'adding to collections' do
|
|
177
|
+
let!(:collection1) { FactoryGirl.create(:collection, user: user) }
|
|
178
|
+
let!(:collection2) { FactoryGirl.create(:collection, user: user) }
|
|
179
|
+
let(:attributes) {
|
|
180
|
+
FactoryGirl.attributes_for(:generic_work, collection_ids: [collection2.id])
|
|
181
|
+
}
|
|
182
|
+
before do
|
|
183
|
+
curation_concern.apply_depositor_metadata(user.user_key)
|
|
184
|
+
curation_concern.save!
|
|
185
|
+
collection1.add_member(curation_concern)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it "remove from the old collection and adds to the new collection" do
|
|
189
|
+
curation_concern.reload
|
|
190
|
+
expect(curation_concern.parent_collections).to eq [collection1]
|
|
191
|
+
# before running actor.update, the work is in collection1
|
|
192
|
+
|
|
193
|
+
expect(subject.update).to be true
|
|
194
|
+
|
|
195
|
+
curation_concern.reload
|
|
196
|
+
expect(curation_concern.identifier).to be_blank
|
|
197
|
+
expect(curation_concern).to be_persisted
|
|
198
|
+
# after running actor.update, the work is in collection2 and no longer in collection1
|
|
199
|
+
expect(curation_concern.parent_collections).to eq [collection2]
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CatalogController do
|
|
4
|
+
before do
|
|
5
|
+
ActiveFedora::Base.delete_all
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe "when logged in" do
|
|
9
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
10
|
+
let!(:work1) { FactoryGirl.create(:work_with_one_file, user: user) }
|
|
11
|
+
let!(:work2) { FactoryGirl.create(:public_generic_work) }
|
|
12
|
+
let!(:collection) { FactoryGirl.create(:collection, user: user) }
|
|
13
|
+
let!(:file) { work1.generic_files.first }
|
|
14
|
+
before do
|
|
15
|
+
sign_in user
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context "when there is private content" do
|
|
19
|
+
let!(:private_work) { FactoryGirl.create(:private_generic_work) }
|
|
20
|
+
|
|
21
|
+
it "excludes it" do
|
|
22
|
+
get 'index'
|
|
23
|
+
expect(response).to be_successful
|
|
24
|
+
expect(assigns(:document_list).map(&:id)).to match_array [work1.id, work2.id, collection.id]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "Searching all content" do
|
|
29
|
+
it "should exclude linked resources" do
|
|
30
|
+
get 'index'
|
|
31
|
+
expect(response).to be_successful
|
|
32
|
+
expect(assigns(:document_list).map(&:id)).to match_array [work1.id, work2.id, collection.id]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
context "Searching all works" do
|
|
37
|
+
it "should return all the works" do
|
|
38
|
+
get 'index', 'f' => {'generic_type_sim' => 'Work'}
|
|
39
|
+
expect(response).to be_successful
|
|
40
|
+
expect(assigns(:document_list).count).to eq 2
|
|
41
|
+
[work1.id, work2.id].each do |work_id|
|
|
42
|
+
expect(assigns(:document_list).map(&:id)).to include(work_id)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context "Searching all collections" do
|
|
48
|
+
it "should return all the works" do
|
|
49
|
+
get 'index', 'f' => {'generic_type_sim' => 'Collection'}
|
|
50
|
+
expect(response).to be_successful
|
|
51
|
+
expect(assigns(:document_list).map(&:id)).to eq [collection.id]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context "searching just my works" do
|
|
56
|
+
it "should return just my works" do
|
|
57
|
+
get 'index', works: 'mine', 'f' => {'generic_type_sim' => 'Work'}
|
|
58
|
+
expect(response).to be_successful
|
|
59
|
+
expect(assigns(:document_list).map(&:id)).to eq [work1.id]
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context "searching for one kind of work" do
|
|
64
|
+
it "returns just the specified type" do
|
|
65
|
+
get 'index', 'f' => {'human_readable_type_sim' => 'Generic Work'}
|
|
66
|
+
expect(response).to be_successful
|
|
67
|
+
expect(assigns(:document_list).map(&:id)).to include(work1.id, work2.id)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
context "when json is requested for autosuggest of related works" do
|
|
72
|
+
let!(:work) { FactoryGirl.create(:generic_work, user: user, title: ["All my #{srand}"]) }
|
|
73
|
+
it "should return json" do
|
|
74
|
+
xhr :get, :index, format: :json, q: work.title
|
|
75
|
+
json = JSON.parse(response.body)
|
|
76
|
+
# Grab the doc corresponding to work and inspect the json
|
|
77
|
+
work_json = json["docs"].first
|
|
78
|
+
expect(work_json).to eq("pid"=>work.id, "title"=> "#{work.title.first} (#{work.human_readable_type})")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe "when logged in as a repository manager" do
|
|
85
|
+
let(:creating_user) { FactoryGirl.create(:user) }
|
|
86
|
+
let(:manager_user) { FactoryGirl.create(:user) }
|
|
87
|
+
let!(:work1) { FactoryGirl.create(:private_generic_work, user: creating_user) }
|
|
88
|
+
let!(:work2) { FactoryGirl.create(:embargoed_work, user: creating_user) }
|
|
89
|
+
let!(:collection) { FactoryGirl.create(:collection, user: creating_user) }
|
|
90
|
+
|
|
91
|
+
before do
|
|
92
|
+
allow_any_instance_of(User).to receive(:groups).and_return(['admin'])
|
|
93
|
+
sign_in manager_user
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
context "searching all works" do
|
|
97
|
+
it "should return other users' private works" do
|
|
98
|
+
get 'index', 'f' => {'generic_type_sim' => 'Work'}
|
|
99
|
+
expect(response).to be_successful
|
|
100
|
+
expect(assigns(:document_list).map(&:id)).to include(work1.id)
|
|
101
|
+
end
|
|
102
|
+
it "should return other users' embargoed works" do
|
|
103
|
+
get 'index', 'f' => {'generic_type_sim' => 'Work'}
|
|
104
|
+
expect(response).to be_successful
|
|
105
|
+
expect(assigns(:document_list).map(&:id)).to include(work2.id)
|
|
106
|
+
end
|
|
107
|
+
it "should return other users' private collections" do
|
|
108
|
+
get 'index', 'f' => {'generic_type_sim' => 'Collection'}
|
|
109
|
+
expect(response).to be_successful
|
|
110
|
+
expect(assigns(:document_list).map(&:id)).to include(collection.id)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::ClassifyConcernsController do
|
|
4
|
+
routes { CurationConcerns::Engine.routes }
|
|
5
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
6
|
+
|
|
7
|
+
describe '#new' do
|
|
8
|
+
it 'requires authentication' do
|
|
9
|
+
get :new
|
|
10
|
+
expect(response).to redirect_to(main_app.user_session_path)
|
|
11
|
+
end
|
|
12
|
+
it 'renders when signed in' do
|
|
13
|
+
sign_in(user)
|
|
14
|
+
get :new
|
|
15
|
+
expect(response).to be_successful
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe '#create' do
|
|
20
|
+
context 'without logging in' do
|
|
21
|
+
it 'redirect to login page if user is not logged in' do
|
|
22
|
+
post :create, classify: { curation_concern_type: 'GenericWork' }
|
|
23
|
+
expect(response).to redirect_to(main_app.user_session_path)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'when logged in' do
|
|
28
|
+
before do
|
|
29
|
+
sign_in(user)
|
|
30
|
+
# Had to stub the actual handling of curation_concern paths since those paths live outside the engine while the path to this controller lives inside the engine.
|
|
31
|
+
expect(subject).to receive(:new_polymorphic_path).with([:curation_concerns, GenericWork]).and_return(main_app.new_curation_concerns_generic_work_path)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
let(:new_curation_concern_generic_work_path) { "/stub/path" }
|
|
35
|
+
|
|
36
|
+
it 'requires authentication' do
|
|
37
|
+
post :create, classify_concern: { curation_concern_type: 'GenericWork' }
|
|
38
|
+
expect(response).to redirect_to(main_app.new_curation_concerns_generic_work_path)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|