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,171 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CollectionsController do
|
|
4
|
+
routes { Hydra::Collections::Engine.routes }
|
|
5
|
+
before do
|
|
6
|
+
allow_any_instance_of(User).to receive(:groups).and_return([])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
10
|
+
let(:asset1) { FactoryGirl.build(:generic_work, title: ["First of the Assets"], user: user) }
|
|
11
|
+
let(:asset2) { FactoryGirl.build(:generic_work, title: ["Second of the Assets"], user: user, depositor: user.user_key) }
|
|
12
|
+
let(:asset3) { FactoryGirl.build(:generic_work, title: ["Third of the Assets"]) }
|
|
13
|
+
let!(:asset4) { FactoryGirl.create(:generic_work, title: ["Fourth of the Assets"], user: user) }
|
|
14
|
+
let(:bogus_depositor_asset) { FactoryGirl.create(:generic_work, title: ["Bogus Asset"], depositor: 'abc') }
|
|
15
|
+
let(:collection_attrs) { FactoryGirl.attributes_for(:collection, title: "My First Collection ", description: "The Description\r\n\r\nand more") }
|
|
16
|
+
let(:collection) { FactoryGirl.create(:collection, title: "Collection Title", user: user) }
|
|
17
|
+
|
|
18
|
+
describe '#new' do
|
|
19
|
+
before do
|
|
20
|
+
sign_in user
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should assign @collection' do
|
|
24
|
+
get :new
|
|
25
|
+
expect(assigns(:collection)).to be_kind_of(Collection)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#create' do
|
|
30
|
+
before do
|
|
31
|
+
sign_in user
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should create a Collection" do
|
|
35
|
+
expect {
|
|
36
|
+
post :create, collection: collection_attrs
|
|
37
|
+
}.to change{ Collection.count }.by(1)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should remove blank strings from params before creating Collection" do
|
|
41
|
+
expect {
|
|
42
|
+
post :create, collection: collection_attrs.merge(creator: [""])
|
|
43
|
+
}.to change{ Collection.count }.by(1)
|
|
44
|
+
expect(assigns[:collection].title).to eq("My First Collection ")
|
|
45
|
+
expect(assigns[:collection].creator).to eq([])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should create a Collection with files I can access" do
|
|
49
|
+
[ asset1, asset2 ].map(&:save) # bogus_depositor_asset is already saved
|
|
50
|
+
expect {
|
|
51
|
+
post :create, collection: collection_attrs,
|
|
52
|
+
batch_document_ids: [asset1.id, asset2.id, bogus_depositor_asset.id]
|
|
53
|
+
}.to change{ Collection.count }.by(1)
|
|
54
|
+
collection = assigns(:collection)
|
|
55
|
+
expect(collection.members).to match_array [asset1, asset2]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should add docs to the collection if a batch id is provided and add the collection id to the documents in the collection" do
|
|
59
|
+
asset1.save
|
|
60
|
+
post :create, batch_document_ids: [asset1.id], collection: collection_attrs
|
|
61
|
+
expect(assigns[:collection].members).to eq [asset1]
|
|
62
|
+
|
|
63
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
|
64
|
+
expect(asset_results["response"]["numFound"]).to eq 1
|
|
65
|
+
|
|
66
|
+
doc = asset_results["response"]["docs"].first
|
|
67
|
+
expect(doc["id"]).to eq asset1.id
|
|
68
|
+
|
|
69
|
+
afterupdate = GenericWork.find(asset1.id)
|
|
70
|
+
expect(doc[Solrizer.solr_name(:collection)]).to eq afterupdate.to_solr[Solrizer.solr_name(:collection)]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe "#update" do
|
|
76
|
+
before { sign_in user }
|
|
77
|
+
|
|
78
|
+
context "a collections members" do
|
|
79
|
+
before do
|
|
80
|
+
[ asset1, asset2 ].map(&:save) # bogus_depositor_asset is already saved
|
|
81
|
+
bogus_depositor_asset.apply_depositor_metadata(user.user_key)
|
|
82
|
+
bogus_depositor_asset.save
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "should set collection on members" do
|
|
86
|
+
put :update, id: collection,
|
|
87
|
+
collection: { members:"add" },
|
|
88
|
+
batch_document_ids: [ bogus_depositor_asset.id, asset1.id, asset2.id ]
|
|
89
|
+
expect(response).to redirect_to routes.url_helpers.collection_path(collection)
|
|
90
|
+
expect(assigns[:collection].members).to match_array [ asset2, bogus_depositor_asset, asset1 ]
|
|
91
|
+
|
|
92
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
|
93
|
+
expect(asset_results["response"]["numFound"]).to eq 1
|
|
94
|
+
|
|
95
|
+
doc = asset_results["response"]["docs"].first
|
|
96
|
+
expect(doc["id"]).to eq asset2.id
|
|
97
|
+
|
|
98
|
+
afterupdate = GenericWork.find(asset2.id)
|
|
99
|
+
expect(doc[Solrizer.solr_name(:collection)]).to eq afterupdate.to_solr[Solrizer.solr_name(:collection)]
|
|
100
|
+
|
|
101
|
+
put :update, id: collection,
|
|
102
|
+
collection: { members: "remove" },
|
|
103
|
+
batch_document_ids: [ asset2 ]
|
|
104
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
|
105
|
+
expect(asset_results["response"]["numFound"]).to eq 1
|
|
106
|
+
|
|
107
|
+
doc = asset_results["response"]["docs"].first
|
|
108
|
+
expect(doc["id"]).to eq asset2.id
|
|
109
|
+
|
|
110
|
+
afterupdate = GenericWork.find(asset2.id)
|
|
111
|
+
expect(doc[Solrizer.solr_name(:collection)]).to be_nil
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
context "updating a collections metadata" do
|
|
116
|
+
it "should save the metadata" do
|
|
117
|
+
put :update, id: collection, collection: { creator: ['Emily'] }
|
|
118
|
+
collection.reload
|
|
119
|
+
expect(collection.creator).to eq ['Emily']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "should remove blank strings from params before updating Collection metadata" do
|
|
123
|
+
put :update, id: collection, collection: collection_attrs.merge(creator: [""])
|
|
124
|
+
expect(assigns[:collection].title).to eq("My First Collection ")
|
|
125
|
+
expect(assigns[:collection].creator).to eq([])
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
describe "#show" do
|
|
132
|
+
|
|
133
|
+
context "when signed in" do
|
|
134
|
+
before do
|
|
135
|
+
sign_in user
|
|
136
|
+
[ asset1, asset2, asset3 ].map { |a| a.apply_depositor_metadata(user); a.save }
|
|
137
|
+
collection.members = [ asset1, asset2, asset3 ]
|
|
138
|
+
collection.save
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "should return the collection and its members" do
|
|
142
|
+
get :show, id: collection
|
|
143
|
+
expect(response).to be_successful
|
|
144
|
+
expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
|
|
145
|
+
expect(assigns[:collection].title).to eq collection.title
|
|
146
|
+
expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map(&:id)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
context "not signed in" do
|
|
151
|
+
before do
|
|
152
|
+
collection.members = [ asset1, asset2, asset3 ]
|
|
153
|
+
collection.save
|
|
154
|
+
end
|
|
155
|
+
it "should force me to log in" do
|
|
156
|
+
get :show, id: collection
|
|
157
|
+
expect(response).to redirect_to(main_app.new_user_session_path)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
describe "#edit" do
|
|
163
|
+
|
|
164
|
+
before { sign_in user }
|
|
165
|
+
|
|
166
|
+
it "should not show flash" do
|
|
167
|
+
get :edit, id: collection
|
|
168
|
+
expect(flash[:notice]).to be_nil
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericFilesController do
|
|
4
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
5
|
+
let(:file) { fixture_file_upload('files/image.png','image/png') }
|
|
6
|
+
let(:parent) { FactoryGirl.create(:generic_work, edit_users: [user.user_key], visibility:Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) }
|
|
7
|
+
|
|
8
|
+
context "when signed in" do
|
|
9
|
+
before { sign_in user }
|
|
10
|
+
|
|
11
|
+
describe "#create" do
|
|
12
|
+
before do
|
|
13
|
+
GenericFile.destroy_all
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "on the happy path" do
|
|
17
|
+
let(:date_today) { DateTime.now }
|
|
18
|
+
|
|
19
|
+
before do
|
|
20
|
+
allow(DateTime).to receive(:now).and_return(date_today)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "spawns a CharacterizeJob" do
|
|
24
|
+
s2 = double('one')
|
|
25
|
+
expect(CharacterizeJob).to receive(:new).and_return(s2)
|
|
26
|
+
expect(CurationConcerns.queue).to receive(:push).with(s2).once
|
|
27
|
+
expect {
|
|
28
|
+
xhr :post, :create, files: [file], parent_id: parent,
|
|
29
|
+
generic_file: { "title"=>["test title"],
|
|
30
|
+
visibility: "restricted"}
|
|
31
|
+
expect(response).to be_success
|
|
32
|
+
}.to change { GenericFile.count }.by(1)
|
|
33
|
+
expect(flash[:error]).to be_nil
|
|
34
|
+
saved_file = assigns[:generic_file].reload
|
|
35
|
+
|
|
36
|
+
expect(saved_file.title).to eq ['test title']
|
|
37
|
+
expect(saved_file.label).to eq 'image.png'
|
|
38
|
+
expect(parent.reload.generic_files).to include saved_file
|
|
39
|
+
# Confirming that date_uploaded and date_modified were set
|
|
40
|
+
expect(saved_file.date_uploaded).to eq date_today.utc
|
|
41
|
+
expect(saved_file.date_modified).to eq date_today.utc
|
|
42
|
+
expect(saved_file.depositor).to eq user.email
|
|
43
|
+
|
|
44
|
+
expect(saved_file.original_file.versions.count).to eq(3)
|
|
45
|
+
expect(saved_file.original_file.versions.last).to be_instance_of(ActiveFedora::VersionsGraph::ResourceVersion)
|
|
46
|
+
|
|
47
|
+
# Confirm that embargo/lease are not set.
|
|
48
|
+
expect(saved_file).to_not be_under_embargo
|
|
49
|
+
expect(saved_file).to_not be_active_lease
|
|
50
|
+
expect(saved_file.visibility).to eq 'restricted'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "copies visibility from the parent" do
|
|
54
|
+
s2 = double('one')
|
|
55
|
+
expect(CharacterizeJob).to receive(:new).and_return(s2)
|
|
56
|
+
allow(CurationConcerns.queue).to receive(:push).with(s2).once
|
|
57
|
+
xhr :post, :create, files: [file], parent_id: parent
|
|
58
|
+
expect(assigns[:generic_file]).to be_persisted
|
|
59
|
+
saved_file = assigns[:generic_file].reload
|
|
60
|
+
expect(saved_file.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context "on something that isn't a file" do
|
|
65
|
+
it "should render error" do
|
|
66
|
+
xhr :post, :create, files: ['hello'], parent_id: parent,
|
|
67
|
+
permission: { group: { 'public' => 'read' } }, terms_of_service: '1'
|
|
68
|
+
expect(response.status).to eq 422
|
|
69
|
+
err = JSON.parse(response.body).first['error']
|
|
70
|
+
expect(err).to match(/no file for upload/i)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
context "when the file has a virus" do
|
|
75
|
+
it "displays a flash error" do
|
|
76
|
+
skip "pending hydra-works#89"
|
|
77
|
+
expect(CurationConcerns::GenericFileActor).to receive(:virus_check).with(file.path).and_raise(CurationConcerns::VirusFoundError.new('A virus was found'))
|
|
78
|
+
xhr :post, :create, files: [file], parent_id: parent,
|
|
79
|
+
permission: { group: { 'public' => 'read' } }, terms_of_service: '1'
|
|
80
|
+
expect(flash[:error]).to include('A virus was found')
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
context "when solr is down" do
|
|
85
|
+
it "should error out of create and save after on continuos rsolr error" do
|
|
86
|
+
allow_any_instance_of(GenericFile).to receive(:save).and_raise(RSolr::Error::Http.new({},{}))
|
|
87
|
+
|
|
88
|
+
xhr :post, :create, files: [file], parent_id: parent,
|
|
89
|
+
permission: { group: { 'public' => 'read' } }, terms_of_service: '1'
|
|
90
|
+
expect(response.body).to include("Error occurred while creating generic file.")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe "destroy" do
|
|
97
|
+
let(:generic_file) do
|
|
98
|
+
generic_file = GenericFile.new.tap do |gf|
|
|
99
|
+
gf.apply_depositor_metadata(user)
|
|
100
|
+
gf.save!
|
|
101
|
+
end
|
|
102
|
+
parent.generic_files << generic_file
|
|
103
|
+
generic_file
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should delete the file" do
|
|
107
|
+
expect(GenericFile.find(generic_file.id)).to be_kind_of GenericFile
|
|
108
|
+
delete :destroy, id: generic_file
|
|
109
|
+
expect { GenericFile.find(generic_file.id) }.to raise_error Ldp::Gone
|
|
110
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(parent)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
describe "update" do
|
|
115
|
+
let!(:generic_file) do
|
|
116
|
+
generic_file = GenericFile.new.tap do |gf|
|
|
117
|
+
gf.apply_depositor_metadata(user)
|
|
118
|
+
gf.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
|
119
|
+
gf.save!
|
|
120
|
+
end
|
|
121
|
+
parent.generic_files << generic_file
|
|
122
|
+
generic_file
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
after do
|
|
126
|
+
generic_file.destroy
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context "updating metadata" do
|
|
130
|
+
it "should be successful and update attributes" do
|
|
131
|
+
post :update, id: generic_file, generic_file:
|
|
132
|
+
{title: ['new_title'], tag: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit'}]}
|
|
133
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_file_path(generic_file)
|
|
134
|
+
expect(assigns[:generic_file].title).to eq(['new_title'])
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it "should go back to edit on an error" do
|
|
138
|
+
allow_any_instance_of(GenericFile).to receive(:valid?).and_return(false)
|
|
139
|
+
post :update, id: generic_file, generic_file:
|
|
140
|
+
{title: ['new_title'], tag: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit'}]}
|
|
141
|
+
expect(response).to be_successful
|
|
142
|
+
expect(response).to render_template('edit')
|
|
143
|
+
expect(assigns[:generic_file]).to eq generic_file
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it "should add a new groups and users" do
|
|
147
|
+
post :update, id: generic_file, generic_file:
|
|
148
|
+
{ title: ['new_title'], tag: [''], permissions_attributes: [{ type: 'group', name: 'group1', access: 'read'}, { type: 'person', name: 'user1', access: 'edit'}]}
|
|
149
|
+
|
|
150
|
+
expect(assigns[:generic_file].read_groups).to eq ["group1"]
|
|
151
|
+
expect(assigns[:generic_file].edit_users).to include("user1")
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it "should update existing groups and users" do
|
|
155
|
+
generic_file.read_groups = ['group3']
|
|
156
|
+
generic_file.save! # TODO slow , more than one save.
|
|
157
|
+
post :update, id: generic_file, generic_file:
|
|
158
|
+
{ title: ['new_title'], tag: [''], permissions_attributes:[{ type: 'group', name: 'group3', access: 'edit'}] }
|
|
159
|
+
expect(assigns[:generic_file].edit_groups).to eq ["group3"]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
context "updating visibility" do
|
|
163
|
+
it "should apply public" do
|
|
164
|
+
new_visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
|
165
|
+
post :update, id: generic_file, generic_file: {visibility: new_visibility, embargo_release_date:""}
|
|
166
|
+
expect(generic_file.reload.visibility).to eq new_visibility
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it "should apply embargo" do
|
|
170
|
+
post :update, id: generic_file, generic_file: {
|
|
171
|
+
visibility: 'embargo',
|
|
172
|
+
visibility_during_embargo: "restricted",
|
|
173
|
+
embargo_release_date: "2099-09-05",
|
|
174
|
+
visibility_after_embargo: "open",
|
|
175
|
+
visibility_during_lease: "open",
|
|
176
|
+
lease_expiration_date: "2099-09-05",
|
|
177
|
+
visibility_after_lease: "restricted"
|
|
178
|
+
}
|
|
179
|
+
generic_file.reload
|
|
180
|
+
expect(generic_file).to be_under_embargo
|
|
181
|
+
expect(generic_file).to_not be_active_lease
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
context "updating file content" do
|
|
187
|
+
it "should be successful" do
|
|
188
|
+
s2 = double('one')
|
|
189
|
+
expect(CharacterizeJob).to receive(:new).with(generic_file.id).and_return(s2)
|
|
190
|
+
expect(CurationConcerns.queue).to receive(:push).with(s2).once
|
|
191
|
+
post :update, id: generic_file, files: [file]
|
|
192
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_file_path(generic_file)
|
|
193
|
+
skip "pending hydra-works#89"
|
|
194
|
+
expect(generic_file.reload.label).to eq 'image.png'
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
context "restoring an old version" do
|
|
199
|
+
before do
|
|
200
|
+
allow(CurationConcerns.queue).to receive(:push) # don't run characterization jobs
|
|
201
|
+
# Create version 1
|
|
202
|
+
Hydra::Works::AddFileToGenericFile.call(generic_file, File.open(fixture_file_path('small_file.txt')), :original_file)
|
|
203
|
+
# Create version 2
|
|
204
|
+
Hydra::Works::AddFileToGenericFile.call(generic_file, File.open(fixture_file_path('curation_concerns_generic_stub.txt')), :original_file)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it "should be successful" do
|
|
208
|
+
expect(generic_file.latest_content_version.label).to eq('version2')
|
|
209
|
+
expect(generic_file.original_file.content).to eq("This is a test fixture for curation_concerns: <%= @id %>.\n")
|
|
210
|
+
post :update, id: generic_file, revision: 'version1'
|
|
211
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_file_path(generic_file)
|
|
212
|
+
reloaded = generic_file.reload.original_file
|
|
213
|
+
expect(reloaded.versions.last.label).to eq 'version3'
|
|
214
|
+
expect(reloaded.content).to eq "small\n"
|
|
215
|
+
expect(reloaded.mime_type).to eq 'text/plain'
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
context "someone elses files" do
|
|
222
|
+
let(:generic_file) do
|
|
223
|
+
generic_file = GenericFile.new.tap do |gf|
|
|
224
|
+
gf.apply_depositor_metadata('archivist1@example.com')
|
|
225
|
+
gf.read_groups = ['public']
|
|
226
|
+
gf.save!
|
|
227
|
+
end
|
|
228
|
+
parent.generic_files << generic_file
|
|
229
|
+
generic_file
|
|
230
|
+
end
|
|
231
|
+
after do
|
|
232
|
+
# GenericFile.find('curation_concerns:5').destroy
|
|
233
|
+
end
|
|
234
|
+
describe "edit" do
|
|
235
|
+
it "should give me a flash error" do
|
|
236
|
+
get :edit, id: generic_file
|
|
237
|
+
expect(response).to fail_redirect_and_flash(main_app.curation_concerns_generic_file_path(generic_file), 'You are not authorized to access this page.')
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
describe "view" do
|
|
241
|
+
it "should show me the file" do
|
|
242
|
+
get :show, id: generic_file
|
|
243
|
+
expect(response).to be_success
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
it "should not let the user submit if they logout" do
|
|
247
|
+
get :new, parent_id: parent
|
|
248
|
+
expect(response).to fail_redirect_and_flash(main_app.new_user_session_path, 'You are not authorized to access this page.')
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericWorksController do
|
|
4
|
+
let(:public_work_factory_name) { :public_generic_work }
|
|
5
|
+
let(:private_work_factory_name) { :work }
|
|
6
|
+
|
|
7
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
8
|
+
before { sign_in user }
|
|
9
|
+
|
|
10
|
+
describe "#show" do
|
|
11
|
+
context "my own private work" do
|
|
12
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name, user: user) }
|
|
13
|
+
it "should show me the page" do
|
|
14
|
+
get :show, id: a_work
|
|
15
|
+
expect(response).to be_success
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context "someone elses private work" do
|
|
20
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name) }
|
|
21
|
+
it "should redirect and show unauthorized message" do
|
|
22
|
+
get :show, id: a_work
|
|
23
|
+
expect(response).to fail_redirect_and_flash(main_app.root_path, 'You are not authorized to access this page.')
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context "someone elses public work" do
|
|
28
|
+
let(:a_work) { FactoryGirl.create(public_work_factory_name) }
|
|
29
|
+
it "should show me the page" do
|
|
30
|
+
get :show, id: a_work
|
|
31
|
+
expect(response).to be_success
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "when I am a repository manager" do
|
|
36
|
+
before { allow_any_instance_of(User).to receive(:groups).and_return(['admin']) }
|
|
37
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name) }
|
|
38
|
+
it "someone elses private work should show me the page" do
|
|
39
|
+
get :show, id: a_work
|
|
40
|
+
expect(response).to be_success
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "#new" do
|
|
46
|
+
context "my work" do
|
|
47
|
+
it "should show me the page" do
|
|
48
|
+
get :new
|
|
49
|
+
expect(response).to be_success
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe "#create" do
|
|
55
|
+
it "should create a work" do
|
|
56
|
+
expect {
|
|
57
|
+
post :create, generic_work: { title: ["a title"] }
|
|
58
|
+
}.to change { GenericWork.count }.by(1)
|
|
59
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(assigns[:curation_concern])
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
describe "#edit" do
|
|
64
|
+
context "my own private work" do
|
|
65
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name, user: user) }
|
|
66
|
+
it "should show me the page" do
|
|
67
|
+
get :edit, id: a_work
|
|
68
|
+
expect(response).to be_success
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context "someone elses private work" do
|
|
73
|
+
routes { Rails.application.class.routes }
|
|
74
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name) }
|
|
75
|
+
it "should redirect and show unauthorized message" do
|
|
76
|
+
get :edit, id: a_work
|
|
77
|
+
expect(response).to fail_redirect_and_flash(main_app.curation_concerns_generic_work_path(assigns[:curation_concern]), 'You are not authorized to access this page.')
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context "someone elses public work" do
|
|
82
|
+
let(:a_work) { FactoryGirl.create(public_work_factory_name) }
|
|
83
|
+
it "should show me the page" do
|
|
84
|
+
get :edit, id: a_work
|
|
85
|
+
expect(response).to fail_redirect_and_flash(main_app.curation_concerns_generic_work_path(assigns[:curation_concern]), 'You are not authorized to access this page.')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
context "when I am a repository manager" do
|
|
90
|
+
before { allow_any_instance_of(User).to receive(:groups).and_return(['admin']) }
|
|
91
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name) }
|
|
92
|
+
it "someone elses private work should show me the page" do
|
|
93
|
+
get :edit, id: a_work
|
|
94
|
+
expect(response).to be_success
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe "#update" do
|
|
100
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name, user: user) }
|
|
101
|
+
|
|
102
|
+
it "should update the work " do
|
|
103
|
+
patch :update, id: a_work, generic_work: { }
|
|
104
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(a_work)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
describe "changing rights" do
|
|
108
|
+
it "should prompt to change the files access" do
|
|
109
|
+
allow(controller).to receive(:actor).and_return(double(update: true, visibility_changed?: true))
|
|
110
|
+
patch :update, id: a_work
|
|
111
|
+
expect(response).to redirect_to main_app.confirm_curation_concerns_permission_path(controller.curation_concern)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
describe "failure" do
|
|
116
|
+
it "renders the form" do
|
|
117
|
+
allow(controller).to receive(:actor).and_return(double(update: false, visibility_changed?: false))
|
|
118
|
+
patch :update, id: a_work
|
|
119
|
+
expect(response).to render_template('edit')
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
context "someone elses public work" do
|
|
124
|
+
let(:a_work) { FactoryGirl.create(public_work_factory_name) }
|
|
125
|
+
it "should redirect and show unauthorized message" do
|
|
126
|
+
get :update, id: a_work
|
|
127
|
+
expect(response).to fail_redirect_and_flash(main_app.root_path, 'You are not authorized to access this page.')
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
context "when I am a repository manager" do
|
|
132
|
+
before { allow_any_instance_of(User).to receive(:groups).and_return(['admin']) }
|
|
133
|
+
let(:a_work) { FactoryGirl.create(private_work_factory_name) }
|
|
134
|
+
it "someone elses private work should update the work" do
|
|
135
|
+
patch :update, id: a_work, generic_work: { }
|
|
136
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(a_work)
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
describe "#destroy" do
|
|
142
|
+
let(:work_to_be_deleted) { FactoryGirl.create(private_work_factory_name, user: user) }
|
|
143
|
+
|
|
144
|
+
it "should delete the work" do
|
|
145
|
+
delete :destroy, id: work_to_be_deleted
|
|
146
|
+
expect(response).to redirect_to main_app.catalog_index_path()
|
|
147
|
+
expect { GenericWork.find(work_to_be_deleted.id) }.to raise_error
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
context "someone elses public work" do
|
|
151
|
+
let(:work_to_be_deleted) { FactoryGirl.create(private_work_factory_name) }
|
|
152
|
+
it "should redirect and show unauthorized message" do
|
|
153
|
+
delete :destroy, id: work_to_be_deleted
|
|
154
|
+
expect(response).to fail_redirect_and_flash(main_app.root_path, 'You are not authorized to access this page.')
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
context "when I am a repository manager" do
|
|
159
|
+
let(:work_to_be_deleted) { FactoryGirl.create(private_work_factory_name) }
|
|
160
|
+
before { allow_any_instance_of(User).to receive(:groups).and_return(['admin']) }
|
|
161
|
+
it "someone elses private work should delete the work" do
|
|
162
|
+
delete :destroy, id: work_to_be_deleted
|
|
163
|
+
expect { GenericWork.find(work_to_be_deleted.id) }.to raise_error
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::PermissionsController do
|
|
4
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
5
|
+
before { sign_in user }
|
|
6
|
+
|
|
7
|
+
describe "#confirm" do
|
|
8
|
+
let(:generic_work) { FactoryGirl.create(:generic_work, user: user) }
|
|
9
|
+
|
|
10
|
+
it "should draw the page" do
|
|
11
|
+
get :confirm, id: generic_work
|
|
12
|
+
expect(response).to be_success
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "#copy" do
|
|
17
|
+
let(:generic_work) { FactoryGirl.create(:generic_work, user: user) }
|
|
18
|
+
let(:worker) { double }
|
|
19
|
+
|
|
20
|
+
it "should add a worker to the queue" do
|
|
21
|
+
expect(VisibilityCopyWorker).to receive(:new).with(generic_work.id).and_return(worker)
|
|
22
|
+
expect(CurationConcerns.queue).to receive(:push).with(worker)
|
|
23
|
+
post :copy, id: generic_work
|
|
24
|
+
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(generic_work)
|
|
25
|
+
expect(flash[:notice]).to eq 'Updating file permissions. This may take a few minutes. You may want to refresh your browser or return to this record later to see the updated file permissions.'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe DownloadsController do
|
|
4
|
+
describe '#show' do
|
|
5
|
+
let(:user) { FactoryGirl.create(:user) }
|
|
6
|
+
let(:another_user) { FactoryGirl.create(:user) }
|
|
7
|
+
let(:generic_file) {
|
|
8
|
+
FactoryGirl.create(:file_with_work, user: user, content: File.open(fixture_file_path('files/image.png')))
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
it "raise not_found if the object does not exist" do
|
|
12
|
+
get :show, id: '8675309'
|
|
13
|
+
expect(response).to be_not_found
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "when user doesn't have access" do
|
|
17
|
+
before do
|
|
18
|
+
# generic_file
|
|
19
|
+
sign_in another_user
|
|
20
|
+
end
|
|
21
|
+
it "redirects to root" do
|
|
22
|
+
get :show, id: generic_file.to_param
|
|
23
|
+
expect(response).to redirect_to root_path
|
|
24
|
+
expect(flash["alert"]).to eq "You are not authorized to access this page."
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "when user isn't logged in" do
|
|
29
|
+
# before { generic_file }
|
|
30
|
+
it "redirects to sign in" do
|
|
31
|
+
get :show, id: generic_file.to_param
|
|
32
|
+
expect(response).to redirect_to new_user_session_path
|
|
33
|
+
expect(flash["alert"]).to eq "You are not authorized to access this page."
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'sends the file if the user has access' do
|
|
38
|
+
# generic_file
|
|
39
|
+
sign_in user
|
|
40
|
+
get :show, id: generic_file.to_param
|
|
41
|
+
expect(response.body).to eq generic_file.original_file.content
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'sends requested file content' do
|
|
45
|
+
Hydra::Works::AddFileToGenericFile.call(generic_file, File.open(fixture_file_path('world.png')), :thumbnail)
|
|
46
|
+
sign_in user
|
|
47
|
+
get :show, id: generic_file.to_param, file: 'thumbnail'
|
|
48
|
+
expect(response.body).to eq generic_file.thumbnail.content
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|