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,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::HomePage, type: :model do
|
4
|
-
let(:home_page) { FactoryBot.create(:home_page) }
|
5
|
-
|
6
|
-
it { is_expected.not_to be_feature_page }
|
7
|
-
it { is_expected.not_to be_about_page }
|
8
|
-
|
9
|
-
it 'displays the sidebar' do
|
10
|
-
expect(home_page).to be_display_sidebar
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'is published' do
|
14
|
-
expect(home_page.published).to be_truthy
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'title' do
|
18
|
-
it 'includes default text' do
|
19
|
-
expect(home_page.title).to eq described_class.default_title_text
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'should_display_title?' do
|
24
|
-
it 'returns the display_title attribute' do
|
25
|
-
home_page.display_title = true
|
26
|
-
expect(home_page).to be_should_display_title
|
27
|
-
home_page.display_title = false
|
28
|
-
expect(home_page).not_to be_should_display_title
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'display_sidebar?' do
|
33
|
-
it 'is false when the page disabled the display_sidebar' do
|
34
|
-
home_page.display_sidebar = false
|
35
|
-
expect(home_page).not_to be_display_sidebar
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Spotlight::Language do
|
4
|
-
describe '#to_native' do
|
5
|
-
it 'is the native translation of the locale' do
|
6
|
-
expect(described_class.new(locale: 'de').to_native).to eq 'Deutsch'
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'is a blank string when the locale does not exist (for string comparison)' do
|
10
|
-
expect(described_class.new(locale: 'xx').to_native).to eq ''
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'when being destroyed' do
|
15
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
16
|
-
let(:language) { described_class.create(locale: 'es', exhibit: exhibit) }
|
17
|
-
|
18
|
-
before { Translation.current_exhibit = exhibit }
|
19
|
-
|
20
|
-
it 'also destroys its locale related pages' do
|
21
|
-
page_es = exhibit.home_page.clone_for_locale('es').tap(&:save)
|
22
|
-
|
23
|
-
expect(Spotlight::Page.exists?(page_es.id)).to be true
|
24
|
-
|
25
|
-
expect do
|
26
|
-
language.destroy
|
27
|
-
end.to change(Spotlight::Page, :count).by(-1)
|
28
|
-
|
29
|
-
expect(Spotlight::Page.exists?(page_es.id)).to be false
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'also destroys its locale related translations' do
|
33
|
-
translation = FactoryBot.create(:translation, key: 'some.key', exhibit: exhibit, locale: 'es')
|
34
|
-
|
35
|
-
expect do
|
36
|
-
language.destroy
|
37
|
-
end.to change(Translation, :count).by(-1)
|
38
|
-
|
39
|
-
expect(Translation.exists?(translation.id)).to be false
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::MainNavigation, type: :model do
|
4
|
-
before do
|
5
|
-
subject.exhibit = FactoryBot.create(:exhibit)
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'has a default_label' do
|
9
|
-
subject.nav_type = :curated_features
|
10
|
-
expect(subject.default_label).to eq 'Curated features'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'returns the use the default label in the absence of a label' do
|
14
|
-
expect(subject.label).to be_blank
|
15
|
-
expect(subject.label_or_default).to eq subject.default_label
|
16
|
-
subject.label = 'something else'
|
17
|
-
expect(subject.label_or_default).to eq 'something else'
|
18
|
-
end
|
19
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::Masthead, type: :model do
|
4
|
-
let(:masthead) { stub_model(described_class) }
|
5
|
-
|
6
|
-
describe '#iiif_url' do
|
7
|
-
it 'inlcudes the appropriate size' do
|
8
|
-
masthead.iiif_tilesource = 'http://example.com/iiif/abc123/info.json'
|
9
|
-
expect(masthead.iiif_url).to match(%r{/full/1800,180/})
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#display?' do
|
14
|
-
subject { masthead.display? }
|
15
|
-
|
16
|
-
let(:image) { OpenStruct.new }
|
17
|
-
|
18
|
-
context 'when the masthead is set to not display' do
|
19
|
-
it { is_expected.to be_falsey }
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'when the cropped image is not present' do
|
23
|
-
before { masthead.display = true }
|
24
|
-
|
25
|
-
it { is_expected.to be_falsey }
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'when the cropped image is present' do
|
29
|
-
before do
|
30
|
-
masthead.iiif_tilesource = 'http://test.host/images/1'
|
31
|
-
masthead.iiif_region = '100,0,200,300'
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'but the masthead is set to not display' do
|
35
|
-
it { is_expected.to be_falsey }
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'and the masthead is set to display' do
|
39
|
-
before { masthead.display = true }
|
40
|
-
|
41
|
-
it { is_expected.to be_truthy }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::PageConfigurations, type: :model do
|
4
|
-
subject(:page_config) { described_class.new(context: view_context, page: page) }
|
5
|
-
|
6
|
-
let(:view_context) do
|
7
|
-
double(
|
8
|
-
'ViewContext',
|
9
|
-
available_view_fields: [],
|
10
|
-
current_exhibit: exhibit,
|
11
|
-
blacklight_config: exhibit.blacklight_config,
|
12
|
-
document_show_link_field: 'document_show_link_field',
|
13
|
-
index_field_label: 'index_field_label',
|
14
|
-
index_fields: [],
|
15
|
-
spotlight: spotlight,
|
16
|
-
t: 'translated-content'
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
21
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
22
|
-
|
23
|
-
describe '#as_json' do
|
24
|
-
it 'is a json-able object (hash)' do
|
25
|
-
expect(page_config.as_json).to be_a Hash
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'downstream configured_params' do
|
30
|
-
it 'merges the supplied hash into the configs' do
|
31
|
-
expect(page_config).to receive_messages(configured_params: { hello: 'goodbye' })
|
32
|
-
|
33
|
-
expect(page_config.as_json).to include(hello: 'goodbye')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'sends the #call method to the value if it can respond (e.g. a lamda)' do
|
37
|
-
expect(view_context).to receive_messages(my_custom_plugin_path: 'my_custom_plugin/data.json')
|
38
|
-
expect(page_config).to receive_messages(
|
39
|
-
configured_params: { 'my-custom-plugin-path': ->(config) { config.context.my_custom_plugin_path } }
|
40
|
-
)
|
41
|
-
|
42
|
-
expect(page_config.as_json).to include('my-custom-plugin-path': 'my_custom_plugin/data.json')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,293 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::Page, type: :model do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let!(:parent_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: true }
|
6
|
-
let!(:child_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: false, parent_page: parent_page }
|
7
|
-
|
8
|
-
describe '.at_top_level' do
|
9
|
-
it 'scopes results to only top level pages' do
|
10
|
-
expect(described_class.at_top_level).not_to include child_page
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.published' do
|
15
|
-
it 'scopes results to only published pages' do
|
16
|
-
expect(described_class.at_top_level).not_to include child_page
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'is expected to be versioned' do
|
21
|
-
expect(subject).to be_versioned
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#top_level_page?' do
|
25
|
-
it 'checks if the page is a top-level page' do
|
26
|
-
expect(parent_page).to be_a_top_level_page
|
27
|
-
expect(child_page).not_to be_a_top_level_page
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#top_level_page_or_self' do
|
32
|
-
it 'fetches the top level page' do
|
33
|
-
expect(child_page.top_level_page_or_self).to be parent_page
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'is the same object if the page is a top level page' do
|
37
|
-
expect(parent_page.top_level_page_or_self).to be parent_page
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '.display_sidebar' do
|
42
|
-
it 'is set to true by default' do
|
43
|
-
expect(parent_page).to be_display_sidebar
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'should_display_title?' do
|
48
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
49
|
-
|
50
|
-
it 'returns if the title is present or not' do
|
51
|
-
expect(page.title).not_to be_blank
|
52
|
-
expect(page).to be_should_display_title
|
53
|
-
page.title = ''
|
54
|
-
expect(page).not_to be_should_display_title
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#content=' do
|
59
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
60
|
-
|
61
|
-
context 'with an alternate page content type' do
|
62
|
-
let(:page) { FactoryBot.create(:feature_page, content_type: 'Static') }
|
63
|
-
let(:fake_class) do
|
64
|
-
Class.new do
|
65
|
-
def self.parse(*_args)
|
66
|
-
'xyz'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
before do
|
72
|
-
# needed so we don't accidentally stub Spotlight::PageContent below
|
73
|
-
require 'spotlight/page_content'
|
74
|
-
stub_const('Spotlight::PageContent::Static', fake_class)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'works' do
|
78
|
-
page.content = [].to_json
|
79
|
-
expect(page.content).to eq 'xyz'
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#content?' do
|
85
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
86
|
-
|
87
|
-
it 'does not have content when the page is empty' do
|
88
|
-
page.content = []
|
89
|
-
expect(page).not_to have_content
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'has content when the page has a widget' do
|
93
|
-
page.content = [{ type: 'rule' }]
|
94
|
-
expect(page).to have_content
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe '#content_type' do
|
99
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
100
|
-
|
101
|
-
it 'can be set as an attribute' do
|
102
|
-
page.content_type = 'Xyz'
|
103
|
-
expect(page.content_type).to eq 'Xyz'
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'defauts to SirTrevor' do
|
107
|
-
expect(page.content_type).to eq 'SirTrevor'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe '#slug' do
|
112
|
-
let(:page) { FactoryBot.create(:about_page) }
|
113
|
-
|
114
|
-
it 'gets a default slug' do
|
115
|
-
expect(page.slug).not_to be_blank
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'is updated when the title changes' do
|
119
|
-
page.update(title: 'abc')
|
120
|
-
expect(page.slug).to eq 'abc'
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'reserves the slug "contacts"' do
|
124
|
-
page.update(title: 'contacts')
|
125
|
-
expect(page.slug).not_to eq 'contacts'
|
126
|
-
end
|
127
|
-
|
128
|
-
context 'with a custom slug' do
|
129
|
-
let(:page) { FactoryBot.create(:feature_page, slug: 'xyz') }
|
130
|
-
|
131
|
-
it 'gets a default slug' do
|
132
|
-
expect(page.slug).to eq 'xyz'
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
describe 'thumbnail_image_url' do
|
138
|
-
subject(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
139
|
-
|
140
|
-
let(:thumbnail) { FactoryBot.create(:featured_image) }
|
141
|
-
|
142
|
-
it 'is nil when there is no thumbnail' do
|
143
|
-
expect(page.thumbnail_image_url).to be_nil
|
144
|
-
end
|
145
|
-
|
146
|
-
it "is returns the thumbnail's IIIF url" do
|
147
|
-
page.thumbnail = thumbnail
|
148
|
-
expect(page.thumbnail_image_url).to eq thumbnail.iiif_url
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
describe 'updated_after?' do
|
153
|
-
let!(:old_page) { FactoryBot.create(:feature_page, updated_at: 10.seconds.ago) }
|
154
|
-
let!(:new_page) { FactoryBot.create(:feature_page) }
|
155
|
-
|
156
|
-
it 'compares the updated_at of the two objects' do
|
157
|
-
expect(new_page).to be_updated_after(old_page)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe 'translated_pages' do
|
162
|
-
subject!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
163
|
-
|
164
|
-
let!(:page_es) { FactoryBot.create(:feature_page, exhibit: exhibit, locale: 'es', default_locale_page: page) }
|
165
|
-
|
166
|
-
it 'is a relation of the other pages that indicate they belong to this page' do
|
167
|
-
expect(page.translated_pages.length).to eq 1
|
168
|
-
expect(page.translated_pages.first).to eq page_es
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe 'clone_for_locale' do
|
173
|
-
subject!(:cloned_page) { page.clone_for_locale('es') }
|
174
|
-
|
175
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit, published: true) }
|
176
|
-
|
177
|
-
it 'creates a new page' do
|
178
|
-
expect do
|
179
|
-
cloned_page.save
|
180
|
-
end.to change(described_class, :count).by(1)
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'has the given locale' do
|
184
|
-
expect(cloned_page.locale).to eq 'es'
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'sets the default_locale_page to self' do
|
188
|
-
expect(cloned_page.default_locale_page).to eq page
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'does not copy the published attribute to the cloned page' do
|
192
|
-
expect(page).to be_published
|
193
|
-
expect(cloned_page).not_to be_published
|
194
|
-
end
|
195
|
-
|
196
|
-
context 'when cloning a child page' do
|
197
|
-
let(:parent_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
198
|
-
let(:parent_cloned_page) { parent_page.clone_for_locale('es') }
|
199
|
-
|
200
|
-
before do
|
201
|
-
parent_cloned_page.save
|
202
|
-
page.update(parent_page_id: parent_page.id)
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'associates the page with the translated version (if present)' do
|
206
|
-
expect(page.clone_for_locale('es').parent_page.id).to eq parent_cloned_page.id
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
context 'when cloning a page that has been deleted with a FriendlyId UUID added' do
|
211
|
-
let(:feature_page_static_title) { FactoryBot.create(:feature_page_static_title, exhibit: exhibit) }
|
212
|
-
let(:feature_page_static_title_two) { FactoryBot.create(:feature_page_static_title, exhibit: exhibit) }
|
213
|
-
|
214
|
-
it 'translated page has the same UUID' do
|
215
|
-
expect(feature_page_static_title.slug).to eq 'featurepage'
|
216
|
-
expect(feature_page_static_title_two.slug).not_to eq feature_page_static_title.slug
|
217
|
-
expect(feature_page_static_title_two.clone_for_locale('es').slug).to eq feature_page_static_title_two.slug
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
context 'when cloning a parent page whose children pages have already been cloned' do
|
222
|
-
let(:parent_page_es) { parent_page.clone_for_locale('es') }
|
223
|
-
let(:child_page_es) { child_page.clone_for_locale('es') }
|
224
|
-
|
225
|
-
before { child_page_es.save }
|
226
|
-
|
227
|
-
it 'updates the translated child pages with the correct parent association' do
|
228
|
-
expect(child_page_es.parent_page).to eq parent_page
|
229
|
-
parent_page_es.save
|
230
|
-
expect(child_page_es.reload.parent_page).to eq parent_page_es
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
describe 'syncing data between translated pages' do
|
236
|
-
let!(:parent_page_es) do
|
237
|
-
FactoryBot.create(
|
238
|
-
:feature_page,
|
239
|
-
exhibit: exhibit,
|
240
|
-
locale: 'es',
|
241
|
-
default_locale_page: parent_page
|
242
|
-
)
|
243
|
-
end
|
244
|
-
let!(:child_page_es) do
|
245
|
-
FactoryBot.create(
|
246
|
-
:feature_page,
|
247
|
-
exhibit: exhibit,
|
248
|
-
locale: 'es',
|
249
|
-
default_locale_page: child_page,
|
250
|
-
parent_page: parent_page_es
|
251
|
-
)
|
252
|
-
end
|
253
|
-
let!(:another_translated_page_es) do
|
254
|
-
FactoryBot.create(
|
255
|
-
:feature_page,
|
256
|
-
exhibit: exhibit,
|
257
|
-
locale: 'es',
|
258
|
-
default_locale_page: another_translated_page
|
259
|
-
)
|
260
|
-
end
|
261
|
-
let!(:another_page) { Spotlight::FeaturePage.create exhibit: exhibit, published: true }
|
262
|
-
let!(:another_translated_page) { Spotlight::FeaturePage.create exhibit: exhibit, published: true }
|
263
|
-
|
264
|
-
it 'updates the translated pages weight' do
|
265
|
-
expect(parent_page_es.weight).not_to be 5
|
266
|
-
parent_page.update(weight: 5)
|
267
|
-
expect(parent_page_es.reload.weight).to be 5
|
268
|
-
end
|
269
|
-
|
270
|
-
it 'sets the parent page id to the equivalent translated parent page' do
|
271
|
-
child_page.update(parent_page: another_translated_page)
|
272
|
-
expect(child_page_es.reload.parent_page).to eq another_translated_page_es
|
273
|
-
end
|
274
|
-
|
275
|
-
it 'updates the parent page when the default locale page becomes a top-level page' do
|
276
|
-
expect(child_page_es.parent_page).to eq parent_page_es
|
277
|
-
child_page.update(parent_page: nil)
|
278
|
-
expect(child_page_es.reload.parent_page).to be_nil
|
279
|
-
end
|
280
|
-
|
281
|
-
it 'removes the parent page id when the child page is set to an as-yet-untranslated parent page' do
|
282
|
-
child_page.update(parent_page: another_page)
|
283
|
-
expect(child_page_es.reload.parent_page).to be_nil
|
284
|
-
end
|
285
|
-
|
286
|
-
it 'updates the attributes separately' do
|
287
|
-
expect(child_page_es.parent_page).to eq parent_page_es
|
288
|
-
child_page.update(weight: 5)
|
289
|
-
expect(child_page_es.reload.weight).to eq 5
|
290
|
-
expect(child_page_es.reload.parent_page).to eq parent_page_es
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::Resource, type: :model do
|
4
|
-
subject(:resource) { described_class.create(id: 123, exhibit: exhibit) }
|
5
|
-
|
6
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
|
8
|
-
describe '#save_and_index' do
|
9
|
-
before do
|
10
|
-
allow(subject).to receive(:save)
|
11
|
-
allow(subject).to receive(:reindex_later)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'saves the object' do
|
15
|
-
expect(subject).to receive(:save).and_return(true)
|
16
|
-
subject.save_and_index
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'reindexes after save' do
|
20
|
-
expect(subject).to receive(:save).and_return(true)
|
21
|
-
expect(subject).to receive(:reindex_later)
|
22
|
-
subject.save_and_index
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'passes through reindexing options' do
|
26
|
-
expect(subject).to receive(:save).and_return(true)
|
27
|
-
expect(subject).to receive(:reindex_later).with(a: 1)
|
28
|
-
subject.save_and_index(reindex_options: { a: 1 })
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'if the save fails' do
|
32
|
-
it 'does not reindex' do
|
33
|
-
expect(subject).to receive(:save).and_return(false)
|
34
|
-
expect(subject).not_to receive(:reindex_later)
|
35
|
-
subject.save_and_index
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#reindex_later' do
|
41
|
-
around do |block|
|
42
|
-
old = ActiveJob::Base.queue_adapter
|
43
|
-
begin
|
44
|
-
ActiveJob::Base.queue_adapter = :test
|
45
|
-
|
46
|
-
block.call
|
47
|
-
ensure
|
48
|
-
ActiveJob::Base.queue_adapter = old
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'passes through reindexing options' do
|
53
|
-
expect { subject.reindex_later(whatever: true) }.to have_enqueued_job(Spotlight::ReindexJob).with(subject, whatever: true, 'validity_token' => nil)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#reindex' do
|
58
|
-
before do
|
59
|
-
# sneak some data into the pipeline
|
60
|
-
subject.indexing_pipeline.transforms = [->(*) { { id: '123' } }] + subject.indexing_pipeline.transforms
|
61
|
-
end
|
62
|
-
|
63
|
-
let(:indexed_document) do
|
64
|
-
result = nil
|
65
|
-
|
66
|
-
subject.reindex(**index_args) do |data, *|
|
67
|
-
result = data
|
68
|
-
|
69
|
-
# skip actually indexing the document into the solr index
|
70
|
-
throw :skip
|
71
|
-
end
|
72
|
-
|
73
|
-
result
|
74
|
-
end
|
75
|
-
|
76
|
-
let(:index_args) { {} }
|
77
|
-
|
78
|
-
it 'returns the number of items indexed' do
|
79
|
-
expect(subject.reindex { |*| throw :skip }).to eq 1
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'applies exhibit-specific metadata from the sidecar' do
|
83
|
-
expect(indexed_document).to include Spotlight::SolrDocumentSidecar.new(document: SolrDocument.new(id: '123'), exhibit: exhibit).to_solr
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'includes metata from each sidecar' do
|
87
|
-
a = Spotlight::SolrDocumentSidecar.create(document: SolrDocument.new(id: '123'), exhibit: exhibit)
|
88
|
-
b = Spotlight::SolrDocumentSidecar.create(document: SolrDocument.new(id: '123'), exhibit: FactoryBot.build(:exhibit))
|
89
|
-
|
90
|
-
expect(indexed_document).to include(a.to_solr).and(include(b.to_solr))
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'persists a sidecar document' do
|
94
|
-
expect { indexed_document }.to change(Spotlight::SolrDocumentSidecar, :count).by(1)
|
95
|
-
|
96
|
-
expect(Spotlight::SolrDocumentSidecar.last).to have_attributes(document_id: '123', exhibit: exhibit)
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'applies application metadata' do
|
100
|
-
expect(indexed_document).to include(spotlight_resource_id_ssim: resource.to_global_id.to_s, spotlight_resource_type_ssim: 'spotlight/resources')
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'with some provided metadata' do
|
104
|
-
let(:index_args) { { additional_metadata: { a: 1 } } }
|
105
|
-
|
106
|
-
it 'applies externally provided metadata' do
|
107
|
-
expect(indexed_document).to include a: 1
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'touches the exhibit to bust any caches' do
|
112
|
-
allow(exhibit).to receive(:touch)
|
113
|
-
|
114
|
-
indexed_document
|
115
|
-
|
116
|
-
expect(exhibit).to have_received(:touch)
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'with touch: false' do
|
120
|
-
it 'does not touch the exhibit' do
|
121
|
-
allow(exhibit).to receive(:touch)
|
122
|
-
|
123
|
-
expect(subject.reindex(touch: false) { |*| throw :skip }).to eq 1
|
124
|
-
|
125
|
-
expect(exhibit).not_to have_received(:touch)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'stores arbitrary data' do
|
131
|
-
subject.data[:a] = 1
|
132
|
-
subject.data[:b] = 2
|
133
|
-
|
134
|
-
expect(subject.data[:a]).to eq 1
|
135
|
-
expect(subject.data[:b]).to eq 2
|
136
|
-
end
|
137
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spotlight::Resources::IiifHarvester do
|
6
|
-
subject(:harvester) { described_class.create(exhibit_id: exhibit.id, url: url) }
|
7
|
-
|
8
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
9
|
-
|
10
|
-
describe 'Validation' do
|
11
|
-
context 'when given an invalid URL' do
|
12
|
-
before do
|
13
|
-
stub_request(:head, 'http://example.com').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:url) { 'http://example.com' }
|
17
|
-
|
18
|
-
it 'errors when the URL is not a IIIF URL' do
|
19
|
-
expect(subject).not_to be_valid
|
20
|
-
expect(subject.errors).to be_present
|
21
|
-
expect(subject.errors[:url]).to eq ['Invalid IIIF URL']
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'when not responding to a HEAD request' do
|
26
|
-
before do
|
27
|
-
stub_request(:head, 'http://example.com').to_return(status: 405, headers: { 'Content-Type' => 'text/html' })
|
28
|
-
stub_request(:get, 'http://example.com').to_return(status: 200, headers: { 'Content-Type' => ' application/ld+json' })
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:url) { 'http://example.com' }
|
32
|
-
|
33
|
-
it 'no errors when the URL responds to the GET request' do
|
34
|
-
expect(subject).to be_valid
|
35
|
-
expect(subject.errors).not_to be_present
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#reindex' do
|
41
|
-
let(:url) { 'uri://for-top-level-collection' }
|
42
|
-
|
43
|
-
before do
|
44
|
-
stub_default_collection
|
45
|
-
allow(Spotlight::Engine.config).to receive(:writable_index).and_return(false)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'indexes all the solr documents' do
|
49
|
-
expect(subject.reindex).to eq 8
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|