blacklight-spotlight 3.4.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spotlight/roles_controller.rb +1 -1
- data/lib/spotlight/version.rb +1 -1
- metadata +6 -610
- data/spec/controllers/application_controller_spec.rb +0 -30
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +0 -239
- data/spec/controllers/spotlight/admin_users_controller_spec.rb +0 -53
- data/spec/controllers/spotlight/appearances_controller_spec.rb +0 -88
- data/spec/controllers/spotlight/application_controller_spec.rb +0 -11
- data/spec/controllers/spotlight/attachments_controller_spec.rb +0 -28
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -133
- data/spec/controllers/spotlight/bulk_actions_controller_spec.rb +0 -124
- data/spec/controllers/spotlight/bulk_updates_controller_spec.rb +0 -77
- data/spec/controllers/spotlight/catalog_controller_spec.rb +0 -552
- data/spec/controllers/spotlight/confirmations_controller_spec.rb +0 -38
- data/spec/controllers/spotlight/contact_email_controller_spec.rb +0 -65
- data/spec/controllers/spotlight/contact_forms_controller_spec.rb +0 -38
- data/spec/controllers/spotlight/contacts_controller_spec.rb +0 -103
- data/spec/controllers/spotlight/custom_fields_controller_spec.rb +0 -62
- data/spec/controllers/spotlight/custom_search_fields_controller_spec.rb +0 -62
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +0 -68
- data/spec/controllers/spotlight/exhibits_controller_spec.rb +0 -216
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -251
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +0 -77
- data/spec/controllers/spotlight/filters_controller_spec.rb +0 -72
- data/spec/controllers/spotlight/groups_controller_spec.rb +0 -103
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -126
- data/spec/controllers/spotlight/job_trackers_controller_spec.rb +0 -37
- data/spec/controllers/spotlight/languages_controller_spec.rb +0 -70
- data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +0 -93
- data/spec/controllers/spotlight/pages_controller_spec.rb +0 -50
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +0 -71
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +0 -55
- data/spec/controllers/spotlight/resources_controller_spec.rb +0 -85
- data/spec/controllers/spotlight/roles_controller_spec.rb +0 -141
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +0 -141
- data/spec/controllers/spotlight/searches_controller_spec.rb +0 -195
- data/spec/controllers/spotlight/sites_controller_spec.rb +0 -67
- data/spec/controllers/spotlight/solr_controller_spec.rb +0 -116
- data/spec/controllers/spotlight/tags_controller_spec.rb +0 -56
- data/spec/controllers/spotlight/translations_controller_spec.rb +0 -132
- data/spec/controllers/spotlight/versions_controller_spec.rb +0 -56
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +0 -35
- data/spec/examples.txt +0 -1515
- data/spec/factories/bulk_updates.rb +0 -21
- data/spec/factories/contact_emails.rb +0 -8
- data/spec/factories/contact_images.rb +0 -8
- data/spec/factories/contacts.rb +0 -11
- data/spec/factories/custom_fields.rb +0 -9
- data/spec/factories/custom_search_fields.rb +0 -9
- data/spec/factories/exhibit_thumbnails.rb +0 -8
- data/spec/factories/exhibits.rb +0 -17
- data/spec/factories/featured_images.rb +0 -16
- data/spec/factories/group.rb +0 -17
- data/spec/factories/job_trackers.rb +0 -11
- data/spec/factories/language.rb +0 -8
- data/spec/factories/main_navigation.rb +0 -9
- data/spec/factories/pages.rb +0 -34
- data/spec/factories/resources.rb +0 -14
- data/spec/factories/roles.rb +0 -9
- data/spec/factories/searches.rb +0 -33
- data/spec/factories/tags.rb +0 -14
- data/spec/factories/translation.rb +0 -8
- data/spec/factories/users.rb +0 -50
- data/spec/features/about_page_spec.rb +0 -46
- data/spec/features/add_contacts_spec.rb +0 -63
- data/spec/features/add_custom_field_metadata_spec.rb +0 -88
- data/spec/features/add_iiif_manifest_spec.rb +0 -46
- data/spec/features/add_items_spec.rb +0 -135
- data/spec/features/autocomplete_typeahead_spec.rb +0 -89
- data/spec/features/browse_category_admin_spec.rb +0 -163
- data/spec/features/browse_category_navigation_spec.rb +0 -44
- data/spec/features/browse_category_spec.rb +0 -158
- data/spec/features/bulk_actions_spec.rb +0 -72
- data/spec/features/catalog_spec.rb +0 -57
- data/spec/features/confirm_email_spec.rb +0 -21
- data/spec/features/create_exhibit_spec.rb +0 -65
- data/spec/features/create_page_spec.rb +0 -21
- data/spec/features/dashboard_spec.rb +0 -34
- data/spec/features/edit_contact_spec.rb +0 -21
- data/spec/features/edit_search_fields_spec.rb +0 -79
- data/spec/features/exhibit_masthead_spec.rb +0 -112
- data/spec/features/exhibit_themes_spec.rb +0 -30
- data/spec/features/exhibits/add_tags_spec.rb +0 -35
- data/spec/features/exhibits/administration_spec.rb +0 -141
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -97
- data/spec/features/exhibits/custom_search_fields_spec.rb +0 -55
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -49
- data/spec/features/exhibits/language_create_edit_spec.rb +0 -59
- data/spec/features/exhibits/translation_editing_spec.rb +0 -463
- data/spec/features/exhibits_index_spec.rb +0 -55
- data/spec/features/feature_page_spec.rb +0 -155
- data/spec/features/home_page_spec.rb +0 -102
- data/spec/features/import_exhibit_spec.rb +0 -58
- data/spec/features/item_admin_spec.rb +0 -59
- data/spec/features/javascript/about_page_admin_spec.rb +0 -21
- data/spec/features/javascript/block_controls_spec.rb +0 -42
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +0 -64
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -46
- data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -61
- data/spec/features/javascript/blocks/link_to_search_block_spec.rb +0 -46
- data/spec/features/javascript/blocks/rule_block_spec.rb +0 -23
- data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -47
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -232
- data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +0 -29
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -94
- data/spec/features/javascript/browse_group_admin_spec.rb +0 -45
- data/spec/features/javascript/edit_in_place_spec.rb +0 -93
- data/spec/features/javascript/feature_page_admin_spec.rb +0 -140
- data/spec/features/javascript/home_page_edit_spec.rb +0 -34
- data/spec/features/javascript/locale_selector_spec.rb +0 -66
- data/spec/features/javascript/metadata_admin_spec.rb +0 -41
- data/spec/features/javascript/multi_image_select_spec.rb +0 -50
- data/spec/features/javascript/reindex_monitor_spec.rb +0 -23
- data/spec/features/javascript/roles_admin_spec.rb +0 -38
- data/spec/features/javascript/search_config_admin_spec.rb +0 -140
- data/spec/features/javascript/search_context_spec.rb +0 -88
- data/spec/features/main_navigation_spec.rb +0 -96
- data/spec/features/metadata_admin_spec.rb +0 -18
- data/spec/features/report_a_problem_spec.rb +0 -62
- data/spec/features/site_masthead_spec.rb +0 -91
- data/spec/features/site_users_management_spec.rb +0 -74
- data/spec/features/slideshow_spec.rb +0 -21
- data/spec/features/translation_scope_spec.rb +0 -27
- data/spec/fixtures/800x600.png +0 -0
- data/spec/fixtures/avatar.png +0 -0
- data/spec/fixtures/bulk-update-template.csv +0 -57
- data/spec/fixtures/csv-upload-fixture.csv +0 -4
- data/spec/fixtures/gk446cj2442-manifest.json +0 -58
- data/spec/fixtures/iiif_responses.rb +0 -312
- data/spec/fixtures/json-upload-fixture.json +0 -3
- data/spec/fixtures/sample_solr_documents.yml +0 -9385
- data/spec/fixtures/updated-bulk-update-template-no-cols.csv +0 -4
- data/spec/fixtures/updated-bulk-update-template-w-tags.csv +0 -4
- data/spec/fixtures/updated-bulk-update-template.csv +0 -4
- data/spec/helpers/spotlight/application_helper_spec.rb +0 -196
- data/spec/helpers/spotlight/browse_helper_spec.rb +0 -13
- data/spec/helpers/spotlight/crop_helper_spec.rb +0 -11
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -163
- data/spec/helpers/spotlight/languages_helper_spec.rb +0 -79
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -101
- data/spec/helpers/spotlight/masthead_helper_spec.rb +0 -51
- data/spec/helpers/spotlight/meta_helper_spec.rb +0 -33
- data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -24
- data/spec/helpers/spotlight/pages_helper_spec.rb +0 -123
- data/spec/helpers/spotlight/roles_helper_spec.rb +0 -7
- data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -23
- data/spec/helpers/spotlight/title_helper_spec.rb +0 -64
- data/spec/helpers/spotlight/translations_helper_spec.rb +0 -16
- data/spec/i18n_spec.rb +0 -27
- data/spec/jobs/spotlight/add_tags_job_spec.rb +0 -34
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +0 -58
- data/spec/jobs/spotlight/change_visibility_job_spec.rb +0 -30
- data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -14
- data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +0 -86
- data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +0 -43
- data/spec/jobs/spotlight/reindex_job_spec.rb +0 -79
- data/spec/jobs/spotlight/remove_tags_job_spec.rb +0 -39
- data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -33
- data/spec/lib/migration/iiif_spec.rb +0 -91
- data/spec/lib/migration/page_language_spec.rb +0 -25
- data/spec/lib/spotlight/catalog_spec.rb +0 -0
- data/spec/lib/spotlight/controller_spec.rb +0 -102
- data/spec/lib/spotlight/upload_field_config_spec.rb +0 -40
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -42
- data/spec/models/sir_trevor_rails/block_spec.rb +0 -72
- data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -42
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +0 -41
- data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +0 -50
- data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +0 -23
- data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -59
- data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -42
- data/spec/models/solr_document_spec.rb +0 -214
- data/spec/models/spotlight/ability_spec.rb +0 -118
- data/spec/models/spotlight/about_page_spec.rb +0 -19
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -82
- data/spec/models/spotlight/analytics/ga_spec.rb +0 -22
- data/spec/models/spotlight/background_job_progress_spec.rb +0 -137
- data/spec/models/spotlight/blacklight_configuration_spec.rb +0 -649
- data/spec/models/spotlight/browse_category_search_builder_spec.rb +0 -51
- data/spec/models/spotlight/contact_email_spec.rb +0 -48
- data/spec/models/spotlight/contact_form_spec.rb +0 -94
- data/spec/models/spotlight/contact_image_spec.rb +0 -11
- data/spec/models/spotlight/contact_spec.rb +0 -38
- data/spec/models/spotlight/custom_field_spec.rb +0 -204
- data/spec/models/spotlight/custom_search_field_spec.rb +0 -56
- data/spec/models/spotlight/custom_translation_extension_spec.rb +0 -24
- data/spec/models/spotlight/exhibit_spec.rb +0 -383
- data/spec/models/spotlight/exhibit_thumbnail_spec.rb +0 -10
- data/spec/models/spotlight/feature_page_spec.rb +0 -87
- data/spec/models/spotlight/featured_image_spec.rb +0 -110
- data/spec/models/spotlight/field_metadata_spec.rb +0 -58
- data/spec/models/spotlight/filter_spec.rb +0 -19
- data/spec/models/spotlight/group_spec.rb +0 -19
- data/spec/models/spotlight/home_page_spec.rb +0 -38
- data/spec/models/spotlight/language_spec.rb +0 -42
- data/spec/models/spotlight/main_navigation_spec.rb +0 -19
- data/spec/models/spotlight/masthead_spec.rb +0 -45
- data/spec/models/spotlight/page_configurations_spec.rb +0 -45
- data/spec/models/spotlight/page_spec.rb +0 -293
- data/spec/models/spotlight/resource_spec.rb +0 -137
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +0 -52
- data/spec/models/spotlight/resources/iiif_manifest_spec.rb +0 -178
- data/spec/models/spotlight/resources/iiif_service_spec.rb +0 -57
- data/spec/models/spotlight/resources/upload_spec.rb +0 -71
- data/spec/models/spotlight/resources/web_spec.rb +0 -25
- data/spec/models/spotlight/role_spec.rb +0 -51
- data/spec/models/spotlight/search_spec.rb +0 -125
- data/spec/models/spotlight/site_spec.rb +0 -9
- data/spec/models/spotlight/sitemap_spec.rb +0 -113
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -56
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -38
- data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -48
- data/spec/models/spotlight/user_spec.rb +0 -26
- data/spec/models/translation_spec.rb +0 -26
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +0 -132
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -34
- data/spec/routing/spotlight/featured_images_spec.rb +0 -23
- data/spec/routing/spotlight/pages_routing_spec.rb +0 -42
- data/spec/services/spotlight/bulk_updates_csv_template_service_spec.rb +0 -26
- data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +0 -16
- data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +0 -30
- data/spec/services/spotlight/etl/context_spec.rb +0 -66
- data/spec/services/spotlight/etl/executor_spec.rb +0 -149
- data/spec/services/spotlight/etl/pipeline_spec.rb +0 -22
- data/spec/services/spotlight/etl/solr_loader_spec.rb +0 -76
- data/spec/services/spotlight/etl/step_spec.rb +0 -70
- data/spec/services/spotlight/exhibit_import_export_service_spec.rb +0 -569
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +0 -94
- data/spec/services/spotlight/invite_users_service_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -146
- data/spec/support/controllers/engine_helpers.rb +0 -9
- data/spec/support/disable_friendly_id_deprecation_warnings.rb +0 -11
- data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +0 -20
- data/spec/support/features/test_features_helpers.rb +0 -92
- data/spec/support/helpers/controller_level_helpers.rb +0 -25
- data/spec/support/stub_iiif_response.rb +0 -26
- data/spec/support/views/test_view_helpers.rb +0 -21
- data/spec/test_app_templates/Gemfile.extra +0 -2
- data/spec/test_app_templates/carrierwave.rb +0 -8
- data/spec/test_app_templates/catalog_controller.rb +0 -108
- data/spec/test_app_templates/fixture.css +0 -0
- data/spec/test_app_templates/fixture.png +0 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -71
- data/spec/test_app_templates/spotlight_test.rake +0 -14
- data/spec/uploaders/spotlight/attachment_uploader_spec.rb +0 -27
- data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +0 -33
- data/spec/views/shared/_analytics.html.erb_spec.rb +0 -17
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -127
- data/spec/views/shared/_header_navbar.html.erb_spec.rb +0 -12
- data/spec/views/shared/_masthead.html.erb_spec.rb +0 -91
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +0 -102
- data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -24
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -69
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -22
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -65
- data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -63
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +0 -39
- data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -43
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -45
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +0 -94
- data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -33
- data/spec/views/spotlight/exhibits/_exhibit_card.html.erb_spec.rb +0 -46
- data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +0 -38
- data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +0 -29
- data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +0 -140
- data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -45
- data/spec/views/spotlight/featured_images/_form.html.erb_spec.rb +0 -32
- data/spec/views/spotlight/featured_images/_upload_form.html.erb_spec.rb +0 -32
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -12
- data/spec/views/spotlight/job_trackers/show.html.erb_spec.rb +0 -65
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +0 -23
- data/spec/views/spotlight/pages/_form.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +0 -68
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -42
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +0 -21
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +0 -84
- data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -36
- data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +0 -58
- data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +0 -40
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -37
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -40
- data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -33
- data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -10
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -43
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -34
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -53
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -42
- data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +0 -25
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -27
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +0 -24
- data/spec/views/spotlight/translations/_page.html.erb_spec.rb +0 -76
@@ -1,569 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ExhibitImportExportService do
|
4
|
-
subject { JSON.parse(described_class.new(source_exhibit).to_json) }
|
5
|
-
|
6
|
-
let!(:source_exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
|
10
|
-
allow_any_instance_of(SolrDocument).to receive(:reindex)
|
11
|
-
allow_any_instance_of(Spotlight::Resource).to receive(:reindex)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'does not include unique identifiers' do
|
15
|
-
expect(subject).not_to have_key 'id'
|
16
|
-
expect(subject).not_to have_key 'slug'
|
17
|
-
expect(subject).not_to have_key 'name'
|
18
|
-
expect(subject).not_to have_key 'default'
|
19
|
-
expect(subject).not_to have_key 'masthead_id'
|
20
|
-
expect(subject).not_to have_key 'thumbnail_id'
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'has search attributes' do
|
24
|
-
expect(subject['searches']).to have(source_exhibit.searches.count).searches
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'has group attributes' do
|
28
|
-
expect(subject['groups']).to have(source_exhibit.groups.count).groups
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'has home page attributes' do
|
32
|
-
expect(subject).to have_key 'home_page'
|
33
|
-
expect(subject['home_page']).not_to have_key 'id'
|
34
|
-
expect(subject['home_page']).not_to have_key 'scope'
|
35
|
-
expect(subject['home_page']).not_to have_key 'exhibit_id'
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'has about pages' do
|
39
|
-
expect(subject['about_pages']).to have(source_exhibit.about_pages.count).pages
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'has feature pages' do
|
43
|
-
expect(subject['feature_pages']).to have(source_exhibit.feature_pages.at_top_level.count).pages
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'has custom fields' do
|
47
|
-
expect(subject['custom_fields']).to have(source_exhibit.custom_fields.count).items
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'has contact emails' do
|
51
|
-
expect(subject['contact_emails']).to have(source_exhibit.contact_emails.count).items
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'has blacklight configuration attributes' do
|
55
|
-
expect(subject).to have_key 'blacklight_configuration'
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'has solr document sidecars' do
|
59
|
-
source_exhibit.solr_document_sidecars.create! document: SolrDocument.new(id: 1), public: false
|
60
|
-
expect(subject['solr_document_sidecars']).to have_at_least(1).item
|
61
|
-
expect(subject['solr_document_sidecars']).to have(source_exhibit.solr_document_sidecars.count).items
|
62
|
-
|
63
|
-
expect(subject['solr_document_sidecars'].first).to include('document_id', 'public')
|
64
|
-
expect(subject['solr_document_sidecars'].first).not_to include 'id'
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'has attachments' do
|
68
|
-
expect(subject['attachments']).to have(source_exhibit.attachments.count).items
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'has languages' do
|
72
|
-
expect(subject['languages']).to have(source_exhibit.languages.count).items
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'has translations' do
|
76
|
-
expect(subject['translations']).to have(source_exhibit.translations.count).items
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'has resources' do
|
80
|
-
expect(subject['resources']).to have(source_exhibit.resources.count).items
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'has tags' do
|
84
|
-
source_exhibit.tag(Spotlight::SolrDocumentSidecar.create(document_id: 1, document_type: 'SolrDocument'), with: 'xyz', on: :tags)
|
85
|
-
expect(subject['owned_taggings']).to have(source_exhibit.owned_taggings.count).items
|
86
|
-
end
|
87
|
-
|
88
|
-
describe 'should round-trip data' do
|
89
|
-
subject do
|
90
|
-
destination_exhibit.import(export)
|
91
|
-
destination_exhibit
|
92
|
-
end
|
93
|
-
|
94
|
-
let(:destination_exhibit) { FactoryBot.create(:exhibit) }
|
95
|
-
|
96
|
-
let :export do
|
97
|
-
described_class.new(source_exhibit).as_json
|
98
|
-
end
|
99
|
-
|
100
|
-
before do
|
101
|
-
sidecar = source_exhibit.solr_document_sidecars.create! document: SolrDocument.new(id: 1), public: false
|
102
|
-
source_exhibit.tag(sidecar, with: 'xyz', on: :tags)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'has exhibit properties' do
|
106
|
-
expect(subject.title).to eq source_exhibit.title
|
107
|
-
end
|
108
|
-
|
109
|
-
context 'with a theme that does not exist in the destination' do
|
110
|
-
it 'ignores the invalid theme' do
|
111
|
-
source_exhibit.theme = 'xyz'
|
112
|
-
expect(subject.theme).to eq nil
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'does not duplicate saved searches' do
|
117
|
-
expect(subject.searches).to have(1).item
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'has blacklight configuration properties' do
|
121
|
-
subject.blacklight_configuration.index_fields_will_change!
|
122
|
-
subject.blacklight_configuration.index_fields['language_ssm'] = { some_value: true }
|
123
|
-
subject.blacklight_configuration.save
|
124
|
-
|
125
|
-
expect(subject.blacklight_configuration).to be_persisted
|
126
|
-
expect(subject.blacklight_configuration.blacklight_config.index_fields['language_ssm'].to_h).to include some_value: true
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'for an exhibit without search fields' do
|
130
|
-
before do
|
131
|
-
source_exhibit.blacklight_configuration.search_fields = {}
|
132
|
-
source_exhibit.blacklight_configuration.save
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'remains without search fields' do
|
136
|
-
expect(subject.blacklight_configuration.search_fields).to be_blank
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'has home page properties' do
|
141
|
-
expect(subject.home_page).to be_persisted
|
142
|
-
expect(subject.home_page.id).not_to eq source_exhibit.home_page.id
|
143
|
-
|
144
|
-
expect(subject.home_page.title).to eq source_exhibit.home_page.title
|
145
|
-
expect(subject.home_page.content).to eq source_exhibit.home_page.content
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'has sidecars' do
|
149
|
-
expect(SolrDocument.new(id: 1)).not_to be_public(subject)
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'for an exhibit with contacts' do
|
153
|
-
context 'for a contact with an avatar' do
|
154
|
-
let!(:curator) do
|
155
|
-
FactoryBot.create(:contact, :with_avatar,
|
156
|
-
exhibit: source_exhibit,
|
157
|
-
contact_info: { title: 'xyz' })
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'has contacts' do
|
161
|
-
expect(subject.contacts.count).to eq 1
|
162
|
-
contact = subject.contacts.first
|
163
|
-
expect(contact.contact_info[:title]).to eq 'xyz'
|
164
|
-
expect(contact.avatar).to be_kind_of Spotlight::ContactImage
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
context 'for a contact without an avatar' do
|
169
|
-
let!(:curator) do
|
170
|
-
FactoryBot.create(:contact, exhibit: source_exhibit, avatar: nil)
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'has contacts' do
|
174
|
-
expect(subject.contacts.count).to eq 1
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'for exhibits with languages and translations' do
|
180
|
-
let!(:language) do
|
181
|
-
source_exhibit.languages.create!(locale: 'zz', public: true, text: 'abc')
|
182
|
-
end
|
183
|
-
|
184
|
-
let!(:translation) do
|
185
|
-
source_exhibit.translations.create!(locale: 'zz', key: 'abc', value: '123')
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'has the language' do
|
189
|
-
expect(subject.languages.count).to eq 1
|
190
|
-
|
191
|
-
language = subject.languages.first
|
192
|
-
expect(language).to have_attributes(locale: 'zz', public: true, text: 'abc')
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'has translations' do
|
196
|
-
expect(subject.translations.count).to eq 1
|
197
|
-
|
198
|
-
translation = subject.translations.unscope(where: :locale).first
|
199
|
-
expect(translation).to have_attributes(locale: 'zz', key: 'abc', value: '123')
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'has tags' do
|
204
|
-
expect(subject.owned_taggings.length).to eq source_exhibit.owned_taggings.length
|
205
|
-
expect(subject.owned_taggings.first).to be_persisted
|
206
|
-
expect(subject.owned_taggings.first.tag.name).to eq 'xyz'
|
207
|
-
end
|
208
|
-
|
209
|
-
context 'with custom main navigation labels' do
|
210
|
-
before do
|
211
|
-
nav = source_exhibit.main_navigations.about
|
212
|
-
nav.label = 'Custom Label'
|
213
|
-
nav.save
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'persists across import/export' do
|
217
|
-
expect(subject.main_navigations.about.label).to eq 'Custom Label'
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
it 'deals with nested feature pages' do
|
222
|
-
FactoryBot.create :feature_subpage, exhibit: source_exhibit
|
223
|
-
expect(subject.feature_pages.at_top_level.length).to eq 1
|
224
|
-
expect(subject.feature_pages.first.child_pages.length).to eq 1
|
225
|
-
end
|
226
|
-
|
227
|
-
context 'page slugs' do
|
228
|
-
let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: source_exhibit, slug: 'xyz') }
|
229
|
-
|
230
|
-
it 'uses the existing slug for the page' do
|
231
|
-
expect(subject.feature_pages.find('xyz')).to be_persisted
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
context 'with a feature page' do
|
236
|
-
let(:feature_page) { FactoryBot.create(:feature_page, exhibit: source_exhibit) }
|
237
|
-
let(:thumbnail) { FactoryBot.create(:featured_image) }
|
238
|
-
|
239
|
-
before do
|
240
|
-
feature_page.content = { data: [{ type: 'text', data: { text: 'xyz' } }] }.to_json
|
241
|
-
feature_page.thumbnail = thumbnail
|
242
|
-
feature_page.save!
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'copies the masthead' do
|
246
|
-
expect(subject.feature_pages.first.thumbnail).not_to be_blank
|
247
|
-
expect(subject.feature_pages.first.thumbnail.image.file.path).not_to eq feature_page.thumbnail.image.file.path
|
248
|
-
end
|
249
|
-
|
250
|
-
it 'copies the thumbnail' do
|
251
|
-
expect(subject.feature_pages.first.thumbnail).not_to be_blank
|
252
|
-
expect(subject.feature_pages.first.thumbnail.image.file.path).not_to eq source_exhibit.feature_pages.first.thumbnail.image.file.path
|
253
|
-
end
|
254
|
-
|
255
|
-
it 'copies the content' do
|
256
|
-
expect(JSON.parse(subject.feature_pages.first.read_attribute(:content))).to have_key 'data'
|
257
|
-
expect(subject.feature_pages.first.content.length).to eq 1
|
258
|
-
expect(subject.feature_pages.first.content.first).to be_a_kind_of SirTrevorRails::Blocks::TextBlock
|
259
|
-
end
|
260
|
-
|
261
|
-
context 'with a translation' do
|
262
|
-
before do
|
263
|
-
localized_page = feature_page.clone_for_locale('ar')
|
264
|
-
localized_page.content = { data: [{ type: 'text', data: { text: 'xyz-in-ar' } }] }.to_json
|
265
|
-
localized_page.save!
|
266
|
-
end
|
267
|
-
|
268
|
-
it 'transfers the localized page' do
|
269
|
-
expect(subject.feature_pages.first.translated_pages.length).to eq 1
|
270
|
-
expect(JSON.parse(subject.feature_pages.first.translated_page_for('ar').read_attribute(:content))).to have_key 'data'
|
271
|
-
expect(subject.feature_pages.first.translated_page_for('ar').content.length).to eq 1
|
272
|
-
expect(subject.feature_pages.first.translated_page_for('ar').content.first).to be_a_kind_of SirTrevorRails::Blocks::TextBlock
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
it 'assigns STI resources the correct class' do
|
278
|
-
resource = FactoryBot.create :uploaded_resource, exhibit: source_exhibit
|
279
|
-
expect(subject.resources.length).to eq 1
|
280
|
-
expect(subject.resources.first.class).to eq Spotlight::Resources::Upload
|
281
|
-
expect(subject.resources.first.upload.image.path).not_to eq resource.upload.image.path
|
282
|
-
end
|
283
|
-
|
284
|
-
it 'assigns normal resources the correct class' do
|
285
|
-
resource = FactoryBot.create :resource, exhibit: source_exhibit
|
286
|
-
expect(subject.resources.length).to eq 1
|
287
|
-
expect(subject.resources.first.class).to eq Spotlight::Resource
|
288
|
-
expect(subject.resources.first.url).to eq resource.url
|
289
|
-
end
|
290
|
-
|
291
|
-
context 'with a browse category' do
|
292
|
-
let(:masthead) { FactoryBot.create(:masthead) }
|
293
|
-
let(:thumbnail) { FactoryBot.create(:featured_image) }
|
294
|
-
let!(:search) { FactoryBot.create(:search, exhibit: source_exhibit, masthead: masthead, thumbnail: thumbnail) }
|
295
|
-
let!(:existing_search) { FactoryBot.create(:search, slug: search.slug, exhibit: destination_exhibit) }
|
296
|
-
|
297
|
-
before do
|
298
|
-
source_exhibit.reload
|
299
|
-
destination_exhibit.reload
|
300
|
-
end
|
301
|
-
|
302
|
-
it 'copies the title' do
|
303
|
-
subject
|
304
|
-
existing_search.reload
|
305
|
-
expect(existing_search.title).to eq search.title
|
306
|
-
end
|
307
|
-
|
308
|
-
it 'copies the masthead' do
|
309
|
-
subject
|
310
|
-
existing_search.reload
|
311
|
-
expect(existing_search.masthead).not_to be_blank
|
312
|
-
expect(existing_search.masthead.image.file.path).not_to eq search.masthead.image.file.path
|
313
|
-
end
|
314
|
-
|
315
|
-
it 'copies the thumbnail' do
|
316
|
-
subject
|
317
|
-
existing_search.reload
|
318
|
-
expect(existing_search.thumbnail).not_to be_blank
|
319
|
-
expect(existing_search.thumbnail.image.file.path).not_to eq search.thumbnail.image.file.path
|
320
|
-
end
|
321
|
-
|
322
|
-
context 'without an attached image' do
|
323
|
-
before do
|
324
|
-
search.masthead.remove_image!
|
325
|
-
search.masthead.save
|
326
|
-
end
|
327
|
-
|
328
|
-
it 'copies the masthead without an image' do
|
329
|
-
subject
|
330
|
-
existing_search.reload
|
331
|
-
expect(existing_search.masthead).not_to be_blank
|
332
|
-
expect(existing_search.masthead.image).to be_blank
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
context 'remote thumbnail with existing tilesource' do
|
337
|
-
it do
|
338
|
-
search.thumbnail.iiif_tilesource
|
339
|
-
search.thumbnail.save
|
340
|
-
source_exhibit.reload
|
341
|
-
end
|
342
|
-
|
343
|
-
it 'unsets the iiif_tilesource' do
|
344
|
-
subject
|
345
|
-
existing_search.reload
|
346
|
-
expect(existing_search.thumbnail.iiif_tilesource).not_to eq search.thumbnail.iiif_tilesource
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
context 'with a thumbnail from an uploaded resource' do
|
351
|
-
before do
|
352
|
-
search.masthead.document_global_id = SolrDocument.new(id: 'xyz').to_global_id
|
353
|
-
search.masthead.source = 'exhibit'
|
354
|
-
search.masthead.iiif_tilesource = 'foo'
|
355
|
-
search.masthead.image = nil # Setting to nil to mimick an exhibit source
|
356
|
-
search.masthead.save
|
357
|
-
|
358
|
-
source_exhibit.reload
|
359
|
-
end
|
360
|
-
|
361
|
-
it 'copies the resource' do
|
362
|
-
subject
|
363
|
-
existing_search.reload
|
364
|
-
expect(existing_search.masthead).not_to be_blank
|
365
|
-
end
|
366
|
-
|
367
|
-
it 'does not unset the iiif_tilesource' do
|
368
|
-
subject
|
369
|
-
existing_search.reload
|
370
|
-
expect(existing_search.masthead.iiif_tilesource).to eq search.masthead.iiif_tilesource
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
context 'in a group' do
|
375
|
-
let!(:group) { FactoryBot.create(:group, title: 'blah', exhibit: source_exhibit) }
|
376
|
-
|
377
|
-
before do
|
378
|
-
search.groups << group
|
379
|
-
search.save!
|
380
|
-
end
|
381
|
-
|
382
|
-
it 'copies the group' do
|
383
|
-
subject
|
384
|
-
expect(destination_exhibit.groups.length).to eq 1
|
385
|
-
expect(destination_exhibit.groups.first.as_json).to include(group.as_json.slice('slug', 'title', 'weight', 'published'))
|
386
|
-
end
|
387
|
-
|
388
|
-
it 'copies the group membership' do
|
389
|
-
subject
|
390
|
-
expect(existing_search.reload.groups.length).to eq 1
|
391
|
-
expect(existing_search.groups.pluck(:slug)).to match_array [group.slug]
|
392
|
-
end
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
context 'with a masthead' do
|
397
|
-
let!(:masthead) { FactoryBot.create(:masthead) }
|
398
|
-
|
399
|
-
before do
|
400
|
-
source_exhibit.masthead = masthead
|
401
|
-
end
|
402
|
-
|
403
|
-
it 'is copied' do
|
404
|
-
expect(subject.masthead).not_to be_blank
|
405
|
-
expect(subject.masthead.image.file.path).not_to eq source_exhibit.masthead.image.file.path
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
context 'with a thumbnail' do
|
410
|
-
let!(:thumbnail) { FactoryBot.create(:exhibit_thumbnail) }
|
411
|
-
|
412
|
-
before do
|
413
|
-
source_exhibit.thumbnail = thumbnail
|
414
|
-
end
|
415
|
-
|
416
|
-
it 'is copied' do
|
417
|
-
expect(subject.thumbnail).not_to be_blank
|
418
|
-
expect(subject.thumbnail.image.file.path).not_to eq source_exhibit.thumbnail.image.file.path
|
419
|
-
end
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
|
-
context 'testing idempotency' do
|
424
|
-
let(:masthead) { FactoryBot.create(:masthead) }
|
425
|
-
let(:thumbnail) { FactoryBot.create(:exhibit_thumbnail) }
|
426
|
-
let!(:search) { FactoryBot.create(:search, exhibit: source_exhibit, masthead: FactoryBot.create(:masthead), thumbnail: FactoryBot.create(:featured_image)) }
|
427
|
-
let!(:feature_page_1) { FactoryBot.create(:feature_page, exhibit: source_exhibit) }
|
428
|
-
let!(:feature_page_2) { FactoryBot.create(:feature_page, exhibit: source_exhibit) }
|
429
|
-
|
430
|
-
before do
|
431
|
-
source_exhibit.masthead = masthead
|
432
|
-
source_exhibit.thumbnail = thumbnail
|
433
|
-
end
|
434
|
-
|
435
|
-
# From Rails 6:
|
436
|
-
def _deep_transform_values_in_object(object, &block)
|
437
|
-
case object
|
438
|
-
when Hash
|
439
|
-
object.transform_values { |value| _deep_transform_values_in_object(value, &block) }
|
440
|
-
when Array
|
441
|
-
object.map { |e| _deep_transform_values_in_object(e, &block) }
|
442
|
-
else
|
443
|
-
yield(object)
|
444
|
-
end
|
445
|
-
end
|
446
|
-
|
447
|
-
it 'is re-runnable' do
|
448
|
-
FactoryBot.create :feature_subpage, exhibit: source_exhibit
|
449
|
-
export = described_class.new(source_exhibit).as_json
|
450
|
-
e = FactoryBot.create(:exhibit)
|
451
|
-
e.import(export)
|
452
|
-
e.import(export)
|
453
|
-
end
|
454
|
-
|
455
|
-
it 'is idempotent-ish' do
|
456
|
-
export = described_class.new(source_exhibit).as_json
|
457
|
-
e = FactoryBot.create(:exhibit)
|
458
|
-
e.import(export)
|
459
|
-
new_export = described_class.new(e).as_json
|
460
|
-
|
461
|
-
actual = _deep_transform_values_in_object(new_export) do |v|
|
462
|
-
if DateTime.parse(v.to_s)
|
463
|
-
nil
|
464
|
-
else
|
465
|
-
v
|
466
|
-
end
|
467
|
-
rescue ArgumentError
|
468
|
-
nil
|
469
|
-
end
|
470
|
-
expected = _deep_transform_values_in_object(export) do |v|
|
471
|
-
if DateTime.parse(v.to_s)
|
472
|
-
nil
|
473
|
-
else
|
474
|
-
v
|
475
|
-
end
|
476
|
-
rescue ArgumentError
|
477
|
-
nil
|
478
|
-
end
|
479
|
-
expect(actual).to include expected
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
|
-
describe 'should export saved searches with query parameters that can be re-generated' do
|
484
|
-
subject do
|
485
|
-
e = FactoryBot.create(:exhibit)
|
486
|
-
e.import(export)
|
487
|
-
e
|
488
|
-
end
|
489
|
-
|
490
|
-
before do
|
491
|
-
source_exhibit.feature_pages.create content: [{
|
492
|
-
type: 'search_results',
|
493
|
-
data: {
|
494
|
-
'item' => {
|
495
|
-
search.slug => { id: search.slug, display: 'true' }
|
496
|
-
},
|
497
|
-
view: ['list']
|
498
|
-
}
|
499
|
-
}].to_json
|
500
|
-
end
|
501
|
-
|
502
|
-
let :export do
|
503
|
-
described_class.new(source_exhibit).as_json
|
504
|
-
end
|
505
|
-
|
506
|
-
context 'with a search object with matching query params' do
|
507
|
-
let :search do
|
508
|
-
source_exhibit.searches.first
|
509
|
-
end
|
510
|
-
|
511
|
-
it 'uses a search within the exhibit' do
|
512
|
-
# searches need to be published.
|
513
|
-
subject.searches.each { |x| x.update published: true }
|
514
|
-
|
515
|
-
expect(subject.feature_pages.first.content.first.search.exhibit).to eq subject
|
516
|
-
end
|
517
|
-
|
518
|
-
it 'uses the existing search object with the same query params' do
|
519
|
-
expect(subject.searches).to have(1).item
|
520
|
-
end
|
521
|
-
end
|
522
|
-
|
523
|
-
context 'with a search object that needs to be created' do
|
524
|
-
let :search do
|
525
|
-
source_exhibit.searches.create title: 'custom query', slug: 'xyz', published: true
|
526
|
-
end
|
527
|
-
|
528
|
-
before do
|
529
|
-
allow(Spotlight::DefaultThumbnailJob).to receive(:perform_later)
|
530
|
-
end
|
531
|
-
|
532
|
-
it 'creates a search within the exhibit' do
|
533
|
-
expect(subject.feature_pages.first.content.first.search.exhibit).to eq subject
|
534
|
-
end
|
535
|
-
|
536
|
-
it 'uses the existing search object with the same query params' do
|
537
|
-
expect(subject.searches).to have(2).items
|
538
|
-
end
|
539
|
-
end
|
540
|
-
end
|
541
|
-
|
542
|
-
context 'with engine configuration disabling all export types' do
|
543
|
-
let(:exports) do
|
544
|
-
{}
|
545
|
-
end
|
546
|
-
|
547
|
-
before do
|
548
|
-
allow(Spotlight::Engine.config).to receive(:exports).and_return(exports)
|
549
|
-
end
|
550
|
-
|
551
|
-
it 'includes nothing' do
|
552
|
-
expect(subject).to be_blank
|
553
|
-
end
|
554
|
-
end
|
555
|
-
|
556
|
-
context 'with engine configuration enabling only pages' do
|
557
|
-
let(:exports) do
|
558
|
-
{ pages: true }
|
559
|
-
end
|
560
|
-
|
561
|
-
before do
|
562
|
-
allow(Spotlight::Engine.config).to receive(:exports).and_return(exports)
|
563
|
-
end
|
564
|
-
|
565
|
-
it 'includes only the page-related data' do
|
566
|
-
expect(subject.keys).to match_array %w[searches groups about_pages feature_pages home_page contacts]
|
567
|
-
end
|
568
|
-
end
|
569
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::IiifResourceResolver do
|
4
|
-
subject(:resolver) { described_class.new(resource) }
|
5
|
-
|
6
|
-
let(:fixture_json) do
|
7
|
-
File.open(
|
8
|
-
File.expand_path(File.join('..', 'spec', 'fixtures', 'gk446cj2442-manifest.json'), Rails.root)
|
9
|
-
).read
|
10
|
-
end
|
11
|
-
let(:iiif_manifest_url) { 'https://purl.stanford.edu/gk446cj2442/manifest.json' }
|
12
|
-
let(:resource) do
|
13
|
-
FactoryBot.create(
|
14
|
-
:featured_image,
|
15
|
-
iiif_manifest_url: iiif_manifest_url,
|
16
|
-
iiif_image_id: 'https://purl.stanford.edu/gk446cj2442/iiif/annotation/gk446cj2442_1',
|
17
|
-
iiif_canvas_id: 'https://purl.stanford.edu/gk446cj2442/iiif/canvas/gk446cj2442_1',
|
18
|
-
iiif_tilesource: 'https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001/info.json'
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
before do
|
23
|
-
expect(resolver).to receive(:response).and_return(fixture_json)
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'success' do
|
27
|
-
context 'when the tilesource has changed' do
|
28
|
-
before do
|
29
|
-
resource.iiif_tilesource = 'a-tilesource-that-no-longer-exists'
|
30
|
-
resource.save
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'the resource is updated and saved' do
|
34
|
-
expect(resource).to receive(:save).and_call_original
|
35
|
-
resolver.resolve!
|
36
|
-
expect(resource.reload.iiif_tilesource).to eq 'https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001/info.json'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'when the tilesource has not changed' do
|
41
|
-
it 'the resource is not saved' do
|
42
|
-
expect(resource).not_to receive(:save)
|
43
|
-
resolver.resolve!
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'a statment indicating nothing was changed is loged' do
|
47
|
-
expect(Rails.logger).to receive(:info).with(
|
48
|
-
"Spotlight::IiifResourceResolver resolved #{iiif_manifest_url}, but nothing changed."
|
49
|
-
)
|
50
|
-
resolver.resolve!
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'failure' do
|
56
|
-
before do
|
57
|
-
expect(resource).not_to receive(:save) # No spec should trigger a save under failure
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when the stored canvas ID is not present' do
|
61
|
-
it 'raises a ManifestError' do
|
62
|
-
resource.iiif_canvas_id = 'not-a-real-canvas-id'
|
63
|
-
|
64
|
-
expect { resolver.resolve! }.to raise_error(
|
65
|
-
Spotlight::IiifResourceResolver::ManifestError,
|
66
|
-
"No canvas with @id not-a-real-canvas-id found in #{iiif_manifest_url}"
|
67
|
-
)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'when the stored image ID is not present' do
|
72
|
-
it 'raises a ManifestError' do
|
73
|
-
resource.iiif_image_id = 'not-a-real-image-id'
|
74
|
-
|
75
|
-
expect { resolver.resolve! }.to raise_error(
|
76
|
-
Spotlight::IiifResourceResolver::ManifestError,
|
77
|
-
"No image with @id not-a-real-image-id found in #{iiif_manifest_url}"
|
78
|
-
)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'when the JSON is unparsable' do
|
83
|
-
let(:fixture_json) { 'Some sort of html error!' }
|
84
|
-
|
85
|
-
it 'logs that the JSON was unparsable and falls through to an no-canvas error' do
|
86
|
-
klass = described_class.name
|
87
|
-
expect(Rails.logger).to receive(:warn).with(
|
88
|
-
a_string_matching(/#{klass} failed to parse #{iiif_manifest_url} with: \d{3}: unexpected token at '#{fixture_json}'/)
|
89
|
-
)
|
90
|
-
expect { resolver.resolve! }.to raise_error(Spotlight::IiifResourceResolver::ManifestError)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::InviteUsersService do
|
4
|
-
subject { described_class.call(resource: resource) }
|
5
|
-
|
6
|
-
let(:resource) do
|
7
|
-
FactoryBot.create(:exhibit, roles: [FactoryBot.create(:role, user: user)])
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'when the user was not created by an invite' do
|
11
|
-
let(:user) { FactoryBot.create(:user) }
|
12
|
-
|
13
|
-
it 'does not send an invite' do
|
14
|
-
expect do
|
15
|
-
subject
|
16
|
-
end.to change { Devise::Mailer.deliveries.count }.by(0)
|
17
|
-
expect(user.reload.invitation_sent_at).to be_nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when the user has already received an invite' do
|
22
|
-
let!(:user) do
|
23
|
-
User.invite!(email: 'a-user-that-does-not-exist@example.com', skip_invitation: true).tap do |u|
|
24
|
-
u.invitation_sent_at = Time.zone.now
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'does not send an invite' do
|
29
|
-
expect do
|
30
|
-
subject
|
31
|
-
end.to change { Devise::Mailer.deliveries.count }.by(0)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'when the user was created by but not yet received an invite' do
|
36
|
-
let(:user) do
|
37
|
-
User.invite!(email: 'a-user-that-does-not-exist@example.com', skip_invitation: true)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'sends an invite' do
|
41
|
-
expect do
|
42
|
-
subject
|
43
|
-
end.to change { Devise::Mailer.deliveries.count }.by(1)
|
44
|
-
expect(user.reload.invitation_sent_at).to be_present
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|