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,49 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::Resque::Queue do
|
|
4
|
+
let(:subject) { CurationConcerns::Resque::Queue.new "test_queue" }
|
|
5
|
+
let(:job) { double('job') }
|
|
6
|
+
|
|
7
|
+
context "with no retries" do
|
|
8
|
+
it "queues the job" do
|
|
9
|
+
expect(::Resque).to receive(:enqueue_to).once.and_return(true)
|
|
10
|
+
subject.push(job)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'when one run times out' do
|
|
15
|
+
before do
|
|
16
|
+
call_count = 0
|
|
17
|
+
allow(::Resque).to receive(:enqueue_to) do
|
|
18
|
+
call_count += 1
|
|
19
|
+
call_count == 1 ? raise(Redis::TimeoutError) : true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'retries the job' do
|
|
24
|
+
expect(::Resque).to receive(:enqueue_to).twice
|
|
25
|
+
subject.push(job)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context 'when a job times out three times' do
|
|
30
|
+
before do
|
|
31
|
+
allow(::Resque).to receive(:enqueue_to).exactly(3).times.and_raise(Redis::TimeoutError)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'raises an error' do
|
|
35
|
+
expect { subject.push(job) }.to raise_error Redis::TimeoutError
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context 'with no connection to Redis' do
|
|
40
|
+
before do
|
|
41
|
+
allow(::Resque).to receive(:enqueue_to).once.and_raise(Redis::CannotConnectError)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'logs an error' do
|
|
45
|
+
expect(ActiveFedora::Base.logger).to receive(:error).with("Redis is down!")
|
|
46
|
+
subject.push(job)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ImportUrlJob do
|
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
5
|
+
|
|
6
|
+
let(:file_path) { fixture_path + '/world.png' }
|
|
7
|
+
let(:file_hash) {'/673467823498723948237462429793840923582'}
|
|
8
|
+
|
|
9
|
+
let(:generic_file) do
|
|
10
|
+
GenericFile.create do |f|
|
|
11
|
+
f.import_url = "http://example.org#{file_hash}"
|
|
12
|
+
f.label = file_path
|
|
13
|
+
f.apply_depositor_metadata(user.user_key)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
let(:mock_response) do
|
|
18
|
+
double('response').tap do |http_res|
|
|
19
|
+
allow(http_res).to receive(:start).and_yield
|
|
20
|
+
allow(http_res).to receive(:content_type).and_return('image/png')
|
|
21
|
+
allow(http_res).to receive(:read_body).and_yield(File.open(File.expand_path(file_path, __FILE__)).read)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
subject(:job) { ImportUrlJob.new(generic_file.id) }
|
|
26
|
+
|
|
27
|
+
it "should have no content at the outset" do
|
|
28
|
+
expect(generic_file.original_file).to be_nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context "after running the job" do
|
|
32
|
+
before do
|
|
33
|
+
s1 = double('characterize')
|
|
34
|
+
allow(CharacterizeJob).to receive(:new).with(generic_file.id).and_return(s1)
|
|
35
|
+
expect(CurationConcerns.queue).to receive(:push).with(s1).once
|
|
36
|
+
expect(ClamAV.instance).to receive(:scanfile).and_return(0)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should create a content datastream" do
|
|
40
|
+
expect_any_instance_of(Net::HTTP).to receive(:request_get).with(file_hash).and_yield(mock_response)
|
|
41
|
+
job.run
|
|
42
|
+
expect(generic_file.reload.original_file.size).to eq 4218
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe IngestLocalFileJob do
|
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
5
|
+
|
|
6
|
+
let(:generic_file) do
|
|
7
|
+
GenericFile.create do |file|
|
|
8
|
+
file.apply_depositor_metadata(user)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
let(:job) { IngestLocalFileJob.new(generic_file.id, mock_upload_directory, "world.png", user.user_key) }
|
|
13
|
+
let(:mock_upload_directory) { 'spec/mock_upload_directory' }
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
Dir.mkdir mock_upload_directory unless File.exists? mock_upload_directory
|
|
17
|
+
FileUtils.copy(File.expand_path('../../fixtures/world.png', __FILE__), mock_upload_directory)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should have attached a file" do
|
|
21
|
+
expect(CurationConcerns::CharacterizationService).to receive(:run).with(generic_file)
|
|
22
|
+
job.run
|
|
23
|
+
expect(generic_file.reload.original_file.size).to eq(4218)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::Messages do
|
|
4
|
+
|
|
5
|
+
let(:message) do
|
|
6
|
+
TestClass.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
class TestClass
|
|
11
|
+
include CurationConcerns::Messages
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after do
|
|
16
|
+
Object.send(:remove_const, :TestClass)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
let(:batch_id) { "1" }
|
|
20
|
+
let(:single) { double(to_param: "1", to_s: "File 1") }
|
|
21
|
+
let(:multiple) { [double(to_param: "1", to_s: "File 1"), double(to_param: "2", to_s: "File 2"), double(to_param: "3", to_s: "File 3")] }
|
|
22
|
+
let(:file_list) { "<a href='/concern/generic_files/1'>File 1</a>, <a href='/concern/generic_files/2'>File 2</a>, <a href='/concern/generic_files/3'>File 3</a>" }
|
|
23
|
+
|
|
24
|
+
describe "message subjects" do
|
|
25
|
+
it "should provide a subject for a success message" do
|
|
26
|
+
expect(message.success_subject).to eq("Batch upload complete")
|
|
27
|
+
end
|
|
28
|
+
it "should provide a subject for a failure message" do
|
|
29
|
+
expect(message.failure_subject).to eq("Batch upload permission denied")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#single_success" do
|
|
34
|
+
it "should render a success message for a single file" do
|
|
35
|
+
node = Capybara::Node::Simple.new(message.single_success(batch_id, single))
|
|
36
|
+
expect(node).to have_selector("span[id=\"ss-1\"]", text:"File 1 has been saved.")
|
|
37
|
+
expect(node).to have_selector("a[href=\"/concern/generic_files/1\"]")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe "#multiple_success" do
|
|
42
|
+
it "should render a success message for multiple files" do
|
|
43
|
+
node = Capybara::Node::Simple.new(message.multiple_success(batch_id, multiple))
|
|
44
|
+
expect(node).to have_selector("span[id=\"ss-1\"]", text:"These files have been saved.")
|
|
45
|
+
expect(node).to have_selector("a[data-content=\"#{file_list}\"][rel=\"popover\"][data-title=\"Files uploaded successfully\"]")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "#single_failure" do
|
|
50
|
+
it "should render a failure message for a single file" do
|
|
51
|
+
node = Capybara::Node::Simple.new(message.single_failure(batch_id, single))
|
|
52
|
+
expect(node).to have_selector("span[id=\"ss-1\"]", text:"File 1 could not be updated. You do not have sufficient privileges to edit it.")
|
|
53
|
+
expect(node).to have_selector("a[href=\"/concern/generic_files/1\"]")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe "#multiple_failure" do
|
|
58
|
+
it "should render a failure message for multiple files" do
|
|
59
|
+
node = Capybara::Node::Simple.new(message.multiple_failure(batch_id, multiple))
|
|
60
|
+
expect(node).to have_selector("span[id=\"ss-1\"]", text:"These files could not be updated. You do not have sufficient privileges to edit them.")
|
|
61
|
+
expect(node).to have_selector("a[data-content=\"#{file_list}\"][rel=\"popover\"][data-title=\"Files failed\"]")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe "#file_list" do
|
|
66
|
+
it "should replace double-quotes with single quotes" do
|
|
67
|
+
expect(message.file_list(multiple)).to eq(file_list)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::Permissions::Readable do
|
|
4
|
+
|
|
5
|
+
class SubjectClass
|
|
6
|
+
include CurationConcerns::Permissions::Readable
|
|
7
|
+
attr_accessor :read_groups
|
|
8
|
+
end
|
|
9
|
+
let(:subject) { SubjectClass.new }
|
|
10
|
+
|
|
11
|
+
describe "#public?" do
|
|
12
|
+
it "should return true for public items" do
|
|
13
|
+
subject.read_groups = ["public","othergroup"]
|
|
14
|
+
expect(subject).to be_public
|
|
15
|
+
end
|
|
16
|
+
it "should return fale for non-public items" do
|
|
17
|
+
subject.read_groups = ["notpublic","othergroup"]
|
|
18
|
+
expect(subject).to_not be_public
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#registered?" do
|
|
23
|
+
it "should return true for registered items" do
|
|
24
|
+
subject.read_groups = ["registered","othergroup"]
|
|
25
|
+
expect(subject).to be_registered
|
|
26
|
+
end
|
|
27
|
+
it "should return fale for non-registered items" do
|
|
28
|
+
subject.read_groups = ["othergroup"]
|
|
29
|
+
expect(subject).to_not be_registered
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "#private?" do
|
|
34
|
+
context "is true" do
|
|
35
|
+
specify "when there are no groups defined" do
|
|
36
|
+
subject.read_groups = []
|
|
37
|
+
expect(subject).to be_private
|
|
38
|
+
end
|
|
39
|
+
specify "when groups do not include 'public' or 'registered'" do
|
|
40
|
+
subject.read_groups = ["othergroup"]
|
|
41
|
+
expect(subject).to be_private
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
context "is false" do
|
|
45
|
+
specify "when 'registered' group is present" do
|
|
46
|
+
subject.read_groups = ["registered"]
|
|
47
|
+
expect(subject).to_not be_private
|
|
48
|
+
end
|
|
49
|
+
specify "when 'public' group is present" do
|
|
50
|
+
subject.read_groups = ["public"]
|
|
51
|
+
expect(subject).to_not be_private
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::Permissions::Writable do
|
|
4
|
+
|
|
5
|
+
class SampleModel < ActiveFedora::Base
|
|
6
|
+
include CurationConcerns::Permissions::Writable
|
|
7
|
+
end
|
|
8
|
+
let(:subject) { SampleModel.new }
|
|
9
|
+
|
|
10
|
+
describe "#permissions" do
|
|
11
|
+
it "should initialize with nothing specified" do
|
|
12
|
+
expect(subject.permissions).to be_empty
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# RSpec matcher to spec delegations.
|
|
2
|
+
|
|
3
|
+
RSpec::Matchers.define :have_unique_field do |expected_field_name|
|
|
4
|
+
match do |subject|
|
|
5
|
+
expect(subject).to respond_to(expected_field_name)
|
|
6
|
+
field_value = subject.send(expected_field_name)
|
|
7
|
+
field_value.nil? || !field_value.kind_of?(Array)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
description do
|
|
11
|
+
"expected to have a single-valued field named #{expected_field_name}"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
failure_message_for_should do |subject|
|
|
15
|
+
"#{subject.inspect} should respond to #{expected_field_name} as a single-value, not an Array. Responded with #{subject.send(expected_field_name).inspect}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
RSpec::Matchers.define :have_multivalue_field do |expected_field_name|
|
|
20
|
+
match do |subject|
|
|
21
|
+
expect(subject).to respond_to(expected_field_name)
|
|
22
|
+
expect(subject.send(expected_field_name)).to be_instance_of Array
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
description do
|
|
26
|
+
"expected to have a multi-valued field named #{expected_field_name}"
|
|
27
|
+
end
|
|
28
|
+
end
|
data/spec/matchers.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'rspec/matchers'
|
|
2
|
+
|
|
3
|
+
if defined?($SHOW_MATCHERS)
|
|
4
|
+
module RSpec::Shim
|
|
5
|
+
def define(matcher_name, *args, &block)
|
|
6
|
+
$SHOW_MATCHERS[matcher_name] = caller.first.split(":")[0..1]
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
def matcher(matcher_name, *args, &block)
|
|
10
|
+
$SHOW_MATCHERS[matcher_name] = caller.first.split(":")[0..1]
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RSpec::Matchers.extend(RSpec::Shim)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
require 'rspec/matchers/dsl'
|
|
19
|
+
require 'rspec-html-matchers'
|
|
20
|
+
require 'rspec-rails'
|
|
21
|
+
require 'rspec/rails'
|
|
22
|
+
require 'rspec/rails/matchers'
|
|
23
|
+
|
|
24
|
+
Dir[File.expand_path('../matchers/**/*.rb', __FILE__)].each { |f| require f }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ChecksumAuditLog do
|
|
4
|
+
before do
|
|
5
|
+
# stub out characterization so it does not get audited
|
|
6
|
+
allow_any_instance_of(CurationConcerns::CharacterizationService).to receive(:characterize)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
let(:f) do
|
|
10
|
+
GenericFile.create do |gf|
|
|
11
|
+
gf.add_file(File.open(fixture_path + '/world.png'), path: 'content', original_name: 'world.png')
|
|
12
|
+
gf.apply_depositor_metadata('mjg36')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
let(:version_uri) { CurationConcerns::VersioningService.create(f.content); f.content.versions.first.uri }
|
|
17
|
+
let(:content_id) { f.content.id }
|
|
18
|
+
let(:old) { ChecksumAuditLog.create(generic_file_id: f.id, file_id: content_id, version: version_uri, pass: 1, created_at: 2.minutes.ago) }
|
|
19
|
+
let(:new) { ChecksumAuditLog.create(generic_file_id: f.id, file_id: content_id, version: version_uri, pass: 0, created_at: 1.minute.ago) }
|
|
20
|
+
|
|
21
|
+
context "a file with multiple checksums audits" do
|
|
22
|
+
specify "should return a list of logs for this datastream sorted by date descending" do
|
|
23
|
+
logs = ChecksumAuditLog.logs_for(f.id, content_id)
|
|
24
|
+
expect(logs).to eq([new, old])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "after multiple checksum audits where the checksum does not change" do
|
|
29
|
+
specify "only one of them should be kept" do
|
|
30
|
+
success1 = ChecksumAuditLog.create(generic_file_id: f.id, file_id: content_id, version: version_uri, pass: 1)
|
|
31
|
+
ChecksumAuditLog.prune_history(f.id, content_id)
|
|
32
|
+
success2 = ChecksumAuditLog.create(generic_file_id: f.id, file_id: content_id, version: version_uri, pass: 1)
|
|
33
|
+
ChecksumAuditLog.prune_history(f.id, content_id)
|
|
34
|
+
success3 = ChecksumAuditLog.create(generic_file_id: f.id, file_id: content_id, version: version_uri, pass: 1)
|
|
35
|
+
ChecksumAuditLog.prune_history(f.id, content_id)
|
|
36
|
+
|
|
37
|
+
expect { ChecksumAuditLog.find(success2.id) }.to raise_exception ActiveRecord::RecordNotFound
|
|
38
|
+
expect { ChecksumAuditLog.find(success3.id) }.to raise_exception ActiveRecord::RecordNotFound
|
|
39
|
+
expect(ChecksumAuditLog.find(success1.id)).not_to be_nil
|
|
40
|
+
logs = ChecksumAuditLog.logs_for(f.id, content_id)
|
|
41
|
+
expect(logs).to eq([success1, new, old])
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context "should have an audit log history" do
|
|
46
|
+
before do
|
|
47
|
+
ChecksumAuditLog.create(generic_file_id: f.id, file_id: f.content.id, version: 'v2', pass: 1)
|
|
48
|
+
ChecksumAuditLog.create(generic_file_id: f.id, file_id: 'thumbnail', version: 'v1', pass: 1)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "has an audit log history" do
|
|
52
|
+
audit = ChecksumAuditLog.get_audit_log(f.id, f.content.id, version_uri)
|
|
53
|
+
expect(audit.generic_file_id).to eq(f.id)
|
|
54
|
+
expect(audit.version).to eq(version_uri)
|
|
55
|
+
|
|
56
|
+
audit = ChecksumAuditLog.get_audit_log(f.id, f.content.id, 'v2')
|
|
57
|
+
expect(audit.generic_file_id).to eq(f.id)
|
|
58
|
+
expect(audit.version).to eq('v2')
|
|
59
|
+
|
|
60
|
+
audit = ChecksumAuditLog.get_audit_log(f.id, 'thumbnail', 'v1')
|
|
61
|
+
expect(audit.generic_file_id).to eq(f.id)
|
|
62
|
+
expect(audit.version).to eq('v1')
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'rspec/active_model/mocks'
|
|
3
|
+
|
|
4
|
+
describe CurationConcerns::CollectionBehavior do
|
|
5
|
+
# All behavior for Collection are defined in CC::CollectionBehavior, so we use
|
|
6
|
+
# a Collection instance to test.
|
|
7
|
+
let(:collection) { FactoryGirl.build(:collection) }
|
|
8
|
+
subject { collection }
|
|
9
|
+
|
|
10
|
+
it "should not allow a collection to be saved without a title" do
|
|
11
|
+
subject.title = nil
|
|
12
|
+
expect{ subject.save! }.to raise_error(ActiveFedora::RecordInvalid)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "::bytes" do
|
|
16
|
+
subject { collection.bytes }
|
|
17
|
+
|
|
18
|
+
context "with no items" do
|
|
19
|
+
before { collection.save }
|
|
20
|
+
it { is_expected.to eq 0 }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "with two 50 byte files" do
|
|
24
|
+
let(:bitstream) { double("content", size: "50")}
|
|
25
|
+
let(:file) { mock_model ::GenericFile, content: bitstream }
|
|
26
|
+
before { allow(collection).to receive(:members).and_return([file, file]) }
|
|
27
|
+
it { is_expected.to eq 100 }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context '.add_member' do
|
|
32
|
+
let(:collectible?) { nil }
|
|
33
|
+
let(:proposed_collectible) { double(collections: []) }
|
|
34
|
+
before(:each) {
|
|
35
|
+
allow(proposed_collectible).to receive(:can_be_member_of_collection?).with(subject).and_return(collectible?)
|
|
36
|
+
allow(proposed_collectible).to receive(:save).and_return(true)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
context 'with itself' do
|
|
40
|
+
it 'does not add it to the collection\'s members' do
|
|
41
|
+
expect {
|
|
42
|
+
subject.add_member(subject)
|
|
43
|
+
}.to_not change{ subject.members.size }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context 'with a non-collectible object' do
|
|
48
|
+
let(:collectible?) { false }
|
|
49
|
+
it 'does not add it to the collection\'s members' do
|
|
50
|
+
expect {
|
|
51
|
+
subject.add_member(proposed_collectible)
|
|
52
|
+
}.to_not change{ subject.members.size }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context 'with a collectible object' do
|
|
57
|
+
let(:collectible?) { true }
|
|
58
|
+
before do
|
|
59
|
+
allow(collection).to receive(:members).and_return([])
|
|
60
|
+
end
|
|
61
|
+
it 'adds it to the collection\'s members' do
|
|
62
|
+
expect {
|
|
63
|
+
subject.add_member(proposed_collectible)
|
|
64
|
+
}.to change{ subject.members.size }.by(1)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'is a pcdm:Collection instance' do
|
|
70
|
+
let(:collection1) { FactoryGirl.build(:collection) }
|
|
71
|
+
let(:work1) { FactoryGirl.build(:work) }
|
|
72
|
+
|
|
73
|
+
it 'should be a pcdm:Collection' do
|
|
74
|
+
expect(subject.pcdm_collection?).to be true
|
|
75
|
+
expect(subject.type).to include RDFVocabularies::PCDMTerms.Collection
|
|
76
|
+
end
|
|
77
|
+
it 'should not be a pcdm:Object' do
|
|
78
|
+
expect(subject.pcdm_object?).to be false
|
|
79
|
+
expect(subject.type).to_not include RDFVocabularies::PCDMTerms.Object
|
|
80
|
+
end
|
|
81
|
+
it 'should have child objects' do
|
|
82
|
+
expect(subject.child_generic_works).to eq []
|
|
83
|
+
expect(subject.child_generic_work_ids).to eq []
|
|
84
|
+
expect(subject.child_generic_works << work1).to eq [work1]
|
|
85
|
+
expect(subject.child_generic_works).to eq [work1]
|
|
86
|
+
expect(subject.child_generic_work_ids).to eq [work1.id]
|
|
87
|
+
end
|
|
88
|
+
it 'should have child collections' do
|
|
89
|
+
expect(subject.child_collections).to eq []
|
|
90
|
+
expect(subject.child_collection_ids).to eq []
|
|
91
|
+
expect(subject.child_collections << collection1).to eq [collection1]
|
|
92
|
+
expect(subject.child_collections).to eq [collection1]
|
|
93
|
+
expect(subject.child_collection_ids).to eq [collection1.id]
|
|
94
|
+
end
|
|
95
|
+
it 'should have related objects' do
|
|
96
|
+
expect(subject.related_objects).to eq []
|
|
97
|
+
expect(subject.related_objects << work1).to eq [work1]
|
|
98
|
+
expect(subject.related_objects).to eq [work1]
|
|
99
|
+
end
|
|
100
|
+
it 'should have parent collections' do
|
|
101
|
+
expect(subject.parent_collections).to eq []
|
|
102
|
+
expect(collection1.child_collections << subject).to eq [subject]
|
|
103
|
+
collection1.save
|
|
104
|
+
expect(subject.parent_collections).to eq [collection1]
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericFile do
|
|
4
|
+
|
|
5
|
+
describe 'audiovisual transcoding' do
|
|
6
|
+
before do
|
|
7
|
+
file = File.open(File.join(fixture_path, file_name), 'r')
|
|
8
|
+
Hydra::Works::UploadFileToGenericFile.call(generic_file, file)
|
|
9
|
+
allow_any_instance_of(Hydra::Works::GenericFile::Base).to receive(:mime_type).and_return(mime_type)
|
|
10
|
+
generic_file.save!
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
context 'with a video (.avi) file', unless: $in_travis do
|
|
15
|
+
let(:mime_type) { 'video/avi' }
|
|
16
|
+
let(:file_name) { 'countdown.avi' }
|
|
17
|
+
let(:generic_file) { GenericFile.create { |gf| gf.apply_depositor_metadata('jcoyne@example.com') } }
|
|
18
|
+
|
|
19
|
+
it 'transcodes to webm and mp4' do
|
|
20
|
+
generic_file.create_derivatives
|
|
21
|
+
derivative = generic_file.webm
|
|
22
|
+
expect(derivative).not_to be_nil
|
|
23
|
+
expect(derivative.content).not_to be_nil
|
|
24
|
+
expect(derivative.mime_type).to eq('video/webm')
|
|
25
|
+
|
|
26
|
+
derivative2 = generic_file.mp4
|
|
27
|
+
expect(derivative2).not_to be_nil
|
|
28
|
+
expect(derivative2.content).not_to be_nil
|
|
29
|
+
expect(derivative2.mime_type).to eq('video/mp4')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context 'with an audio (.wav) file', unless: $in_travis do
|
|
34
|
+
let(:mime_type) { 'audio/wav' }
|
|
35
|
+
let(:file_name) { 'piano_note.wav' }
|
|
36
|
+
let(:generic_file) { GenericFile.create { |gf| gf.apply_depositor_metadata('jcoyne@example.com') } }
|
|
37
|
+
|
|
38
|
+
it 'transcodes to mp3 and ogg' do
|
|
39
|
+
generic_file.create_derivatives
|
|
40
|
+
derivative = generic_file.mp3
|
|
41
|
+
expect(derivative).not_to be_nil
|
|
42
|
+
expect(derivative.content).not_to be_nil
|
|
43
|
+
expect(derivative.mime_type).to eq('audio/mpeg')
|
|
44
|
+
|
|
45
|
+
derivative2 = generic_file.ogg
|
|
46
|
+
expect(derivative2).not_to be_nil
|
|
47
|
+
expect(derivative2.content).not_to be_nil
|
|
48
|
+
expect(derivative2.mime_type).to eq('audio/ogg')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context 'with an mp3 file', unless: $in_travis do
|
|
53
|
+
let(:mime_type) { 'audio/mpeg' }
|
|
54
|
+
let(:file_name) { 'test5.mp3' }
|
|
55
|
+
let(:generic_file) { GenericFile.create { |gf| gf.apply_depositor_metadata('jcoyne@example.com') } }
|
|
56
|
+
|
|
57
|
+
xit 'should copy the content to the mp3 datastream and transcode to ogg' do
|
|
58
|
+
generic_file.create_derivatives
|
|
59
|
+
derivative = generic_file.mp3
|
|
60
|
+
|
|
61
|
+
expect(derivative.size).to eq(generic_file.original_file.size)
|
|
62
|
+
expect(derivative.mime_type).to eq('audio/mpeg')
|
|
63
|
+
derivative2 = generic_file.ogg
|
|
64
|
+
expect(derivative2.content).not_to be_nil
|
|
65
|
+
expect(derivative2.mime_type).to eq('audio/ogg')
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'with an ogg file', unless: $in_travis do
|
|
70
|
+
let(:mime_type) { 'audio/ogg' }
|
|
71
|
+
let(:file_name) { 'Example.ogg' }
|
|
72
|
+
let(:generic_file) { GenericFile.create { |gf| gf.apply_depositor_metadata('jcoyne@example.com') } }
|
|
73
|
+
|
|
74
|
+
xit 'should copy the content to the ogg datastream and transcode to mp3' do
|
|
75
|
+
generic_file.create_derivatives
|
|
76
|
+
derivative = generic_file.mp3
|
|
77
|
+
expect(derivative).not_to be_nil
|
|
78
|
+
expect(derivative.content).not_to be_nil
|
|
79
|
+
expect(derivative.mime_type).to eq('audio/mpeg')
|
|
80
|
+
|
|
81
|
+
derivative2 = generic_file.ogg
|
|
82
|
+
expect(derivative2).not_to be_nil
|
|
83
|
+
expect(derivative2.size).to eq(generic_file.original_file.size)
|
|
84
|
+
expect(derivative2.mime_type).to eq('audio/ogg')
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::GenericWorkBehavior do
|
|
4
|
+
before do
|
|
5
|
+
class EssentialWork < ActiveFedora::Base
|
|
6
|
+
include CurationConcerns::GenericWorkBehavior
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
after do
|
|
10
|
+
Object.send(:remove_const, :EssentialWork)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
subject { EssentialWork.new }
|
|
14
|
+
|
|
15
|
+
it "should mix together all the goodness" do
|
|
16
|
+
[::CurationConcerns::WithGenericFiles, ::CurationConcerns::HumanReadableType, CurationConcerns::Noid, CurationConcerns::Serializers, Hydra::WithDepositor, Hydra::AccessControls::Embargoable, Solrizer::Common].each do |mixin|
|
|
17
|
+
expect(subject.class.ancestors).to include(mixin)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "human_readable_type" do
|
|
22
|
+
it "has a default" do
|
|
23
|
+
expect(subject.human_readable_type).to eq 'Essential Work'
|
|
24
|
+
end
|
|
25
|
+
it "should be settable" do
|
|
26
|
+
EssentialWork.human_readable_type = 'Custom Type'
|
|
27
|
+
expect(subject.human_readable_type).to eq 'Custom Type'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "inherits (and extends) to_solr behaviors from superclass" do
|
|
32
|
+
expect(subject.to_solr.keys).to include(:id)
|
|
33
|
+
expect(subject.to_solr.keys).to include("has_model_ssim")
|
|
34
|
+
end
|
|
35
|
+
end
|