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,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/job_trackers/show', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:job_tracker) { FactoryBot.create(:job_tracker, job_class: 'Spotlight::ReindexExhibitJob', on: exhibit, user: user) }
|
6
|
-
let(:user) { FactoryBot.create(:user) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
assign(:exhibit, exhibit)
|
10
|
-
assign(:job_tracker, job_tracker)
|
11
|
-
|
12
|
-
allow(view).to receive_messages(current_exhibit: exhibit)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'displays the type of job' do
|
16
|
-
render
|
17
|
-
expect(rendered).to have_selector 'h2', text: 'Spotlight::ReindexExhibitJob'
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'displays the job status for enqueued jobs' do
|
21
|
-
job_tracker.update(status: 'enqueued')
|
22
|
-
render
|
23
|
-
expect(rendered).to have_content '⏱'
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'displays the job status for failed jobs' do
|
27
|
-
job_tracker.update(status: 'failed')
|
28
|
-
render
|
29
|
-
expect(rendered).to have_content '🟥'
|
30
|
-
expect(rendered).to have_content 'job failed'
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'displays the job status for successful jobs' do
|
34
|
-
job_tracker.update(status: 'completed')
|
35
|
-
render
|
36
|
-
expect(rendered).to have_content '✅'
|
37
|
-
expect(rendered).to have_content 'job completed'
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'display job started events' do
|
41
|
-
render
|
42
|
-
expect(rendered).to have_selector 'tr', text: '1 job started', normalize_ws: true
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'records who started the job' do
|
46
|
-
render
|
47
|
-
expect(rendered).to have_selector 'tr', text: "2 job created by #{user.email}", normalize_ws: true
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'displays logged messages' do
|
51
|
-
job_tracker.events.create(data: { message: 'this is a useful log message' })
|
52
|
-
job_tracker.events.create(data: { message: 'and so is this' })
|
53
|
-
|
54
|
-
render
|
55
|
-
expect(rendered).to have_selector 'tr', text: 'this is a useful log message'
|
56
|
-
expect(rendered).to have_selector 'tr', text: 'and so is this'
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'displays job progress information' do
|
60
|
-
allow(job_tracker).to receive_messages(progress: 37, total: 51)
|
61
|
-
|
62
|
-
render
|
63
|
-
expect(rendered).to have_content 'processed 37 / 51'
|
64
|
-
end
|
65
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/metadata_configurations/_metadata_field', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:field) { Blacklight::Configuration::Field.new label: 'Some label', immutable: OpenStruct.new(another_view_type: false) }
|
6
|
-
let(:builder) { ActionView::Helpers::FormBuilder.new 'z', nil, view, {} }
|
7
|
-
let(:p) { 'spotlight/metadata_configurations/metadata_field' }
|
8
|
-
|
9
|
-
before do
|
10
|
-
assign(:exhibit, exhibit)
|
11
|
-
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
12
|
-
allow(view).to receive_messages(
|
13
|
-
current_exhibit: exhibit,
|
14
|
-
blacklight_config: exhibit.blacklight_configuration.blacklight_config,
|
15
|
-
available_view_fields: { some_view_type: 1, another_view_type: 2 },
|
16
|
-
select_deselect_button: nil
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'uses the metadata field label' do
|
21
|
-
render partial: p, locals: { key: 'some_key', config: field, f: builder }
|
22
|
-
expect(rendered).to have_selector '.field-label', text: 'Some label'
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'marks views as disabled if they are immutable' do
|
26
|
-
allow(controller).to receive(:enabled_in_spotlight_view_type_configuration?).and_return(true)
|
27
|
-
render partial: p, locals: { key: 'some_key', config: field, f: builder }
|
28
|
-
expect(rendered).to have_selector 'input[disabled][name="z[some_key][another_view_type]"]'
|
29
|
-
end
|
30
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/metadata_configurations/edit', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
|
6
|
-
before do
|
7
|
-
assign(:exhibit, exhibit)
|
8
|
-
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
9
|
-
allow(view).to receive_messages(
|
10
|
-
current_exhibit: exhibit,
|
11
|
-
blacklight_config: exhibit.blacklight_configuration.blacklight_config,
|
12
|
-
available_view_fields: { some_view_type: 1, another_view_type: 2 },
|
13
|
-
select_deselect_button: nil
|
14
|
-
)
|
15
|
-
allow(controller).to receive(:enabled_in_spotlight_view_type_configuration?).and_return(true)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'has columns for the available view types' do
|
19
|
-
render
|
20
|
-
expect(rendered).to have_selector 'th', text: 'Some View Type'
|
21
|
-
expect(rendered).to have_selector 'th', text: 'Another View Type'
|
22
|
-
end
|
23
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/pages/edit', type: :view do
|
4
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
5
|
-
let(:page) { stub_model(Spotlight::FeaturePage, exhibit: exhibit) }
|
6
|
-
let :blacklight_config do
|
7
|
-
Blacklight::Configuration.new
|
8
|
-
end
|
9
|
-
|
10
|
-
before do
|
11
|
-
assign(:page, page)
|
12
|
-
allow(view).to receive_messages(configurations_for_current_page: {},
|
13
|
-
featured_images_path: '/foo')
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'contains data-block-types attribute needed for SirTrevor instantiation' do
|
17
|
-
render
|
18
|
-
expect(rendered).to have_css '.js-st-instance[data-block-types]'
|
19
|
-
end
|
20
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/pages/edit', type: :view do
|
4
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
5
|
-
let(:page) { stub_model(Spotlight::FeaturePage, exhibit: exhibit) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
assign(:page, page)
|
9
|
-
allow(view).to receive_messages(configurations_for_current_page: {},
|
10
|
-
featured_images_path: '/foo')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'renders the edit page form' do
|
14
|
-
render
|
15
|
-
|
16
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
17
|
-
assert_select 'form[action=?][method=?]', spotlight.exhibit_feature_page_path(page.exhibit, page), 'post' do
|
18
|
-
assert_select 'input#feature_page_title[name=?]', 'feature_page[title]'
|
19
|
-
assert_select 'textarea#feature_page_content[name=?]', 'feature_page[content]'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'locks' do
|
24
|
-
let(:lock) { Spotlight::Lock.create! on: page }
|
25
|
-
|
26
|
-
before do
|
27
|
-
page.lock = lock
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'renders a lock' do
|
31
|
-
render
|
32
|
-
|
33
|
-
expect(rendered).to have_css '.alert-lock'
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'does not render an old lock' do
|
37
|
-
lock.created_at -= 1.day
|
38
|
-
|
39
|
-
render
|
40
|
-
|
41
|
-
expect(rendered).not_to have_css '.alert-lock'
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'does not render a lock held by the current session' do
|
45
|
-
lock.current_session!
|
46
|
-
|
47
|
-
render
|
48
|
-
|
49
|
-
expect(rendered).not_to have_css '.alert-lock'
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'attaches a data-lock attribute to the cancel button' do
|
53
|
-
lock.current_session!
|
54
|
-
|
55
|
-
render
|
56
|
-
|
57
|
-
expect(rendered).to have_link 'Cancel'
|
58
|
-
expect(rendered).to have_css "a[data-lock=\"#{url_for([spotlight, page.exhibit, lock])}\"]", text: 'Cancel'
|
59
|
-
end
|
60
|
-
|
61
|
-
it "does not have data-lock attribute if the lock doesn't belong to this session" do
|
62
|
-
render
|
63
|
-
|
64
|
-
expect(rendered).to have_link 'Cancel'
|
65
|
-
expect(rendered).not_to have_css 'a[data-lock]', text: 'Cancel'
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/pages/index.html.erb', type: :view do
|
4
|
-
let(:pages) do
|
5
|
-
[
|
6
|
-
stub_model(Spotlight::FeaturePage,
|
7
|
-
title: 'Title1',
|
8
|
-
content: '[]',
|
9
|
-
exhibit: exhibit),
|
10
|
-
stub_model(Spotlight::FeaturePage,
|
11
|
-
title: 'Title2',
|
12
|
-
content: '[]',
|
13
|
-
exhibit: exhibit)
|
14
|
-
]
|
15
|
-
end
|
16
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
17
|
-
|
18
|
-
before do
|
19
|
-
allow(view).to receive(:page_collection_name).and_return(:feature_pages)
|
20
|
-
allow(view).to receive(:update_all_exhibit_feature_pages_path).and_return('/exhibit/features/update_all')
|
21
|
-
assign(:page, Spotlight::FeaturePage.new)
|
22
|
-
assign(:exhibit, exhibit)
|
23
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'renders a list of pages' do
|
27
|
-
assign(:pages, pages)
|
28
|
-
allow(exhibit).to receive(:feature_pages).and_return pages
|
29
|
-
render
|
30
|
-
expect(rendered).to have_selector '.card-title', text: 'Title1'
|
31
|
-
expect(rendered).to have_selector '.card-title', text: 'Title2'
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'Without pages' do
|
35
|
-
it 'does not disable the update button' do
|
36
|
-
assign(:pages, [])
|
37
|
-
render
|
38
|
-
expect(rendered).not_to have_selector 'button[disabled]', text: 'Save changes'
|
39
|
-
expect(rendered).to have_selector 'button', text: 'Save changes'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/pages/new', type: :view do
|
4
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
5
|
-
|
6
|
-
before do
|
7
|
-
assign(:page, stub_model(Spotlight::FeaturePage, exhibit: exhibit).as_new_record)
|
8
|
-
allow(view).to receive_messages(configurations_for_current_page: {},
|
9
|
-
featured_images_path: '/foo')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'renders new page form' do
|
13
|
-
render
|
14
|
-
|
15
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
|
-
assert_select 'form[action=?][method=?]', spotlight.exhibit_feature_pages_path(exhibit), 'post' do
|
17
|
-
assert_select 'input#feature_page_title[name=?]', 'feature_page[title]'
|
18
|
-
assert_select 'textarea#feature_page_content[name=?]', 'feature_page[content]'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/pages/show', type: :view do
|
4
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
5
|
-
let(:page) do
|
6
|
-
stub_model(Spotlight::FeaturePage,
|
7
|
-
exhibit: exhibit,
|
8
|
-
title: 'Title',
|
9
|
-
content: '[]')
|
10
|
-
end
|
11
|
-
|
12
|
-
before do
|
13
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
14
|
-
allow(view).to receive(:render_body_class).and_return('')
|
15
|
-
assign(:page, page)
|
16
|
-
stub_template 'spotlight/pages/_sidebar.html.erb' => 'Sidebar'
|
17
|
-
stub_template 'spotlight/pages/_tophat.html.erb' => ''
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'renders the title as a heading' do
|
21
|
-
render
|
22
|
-
expect(rendered).to have_css('.page-title', text: page.title)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'does not render an empty heading' do
|
26
|
-
allow(page).to receive_messages(title: nil)
|
27
|
-
render
|
28
|
-
expect(rendered).not_to have_css('.page-title')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'injects the page title into the html title' do
|
32
|
-
expect(view).to receive(:set_html_page_title)
|
33
|
-
render
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'when rendering with layout' do
|
37
|
-
before do
|
38
|
-
allow(page).to receive_messages(title: 'Abbott & Costello')
|
39
|
-
allow_any_instance_of(Spotlight::Exhibit).to receive(:searchable?).and_return(true)
|
40
|
-
stub_template 'shared/_analytics.html.erb' => 'analytics'
|
41
|
-
stub_template 'shared/_user_util_links.html.erb' => ''
|
42
|
-
stub_template 'shared/_masthead.html.erb' => ''
|
43
|
-
render template: 'spotlight/pages/show', layout: 'layouts/spotlight/spotlight'
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'does not double-escape HTML entities in the HTML title' do
|
47
|
-
expect(rendered).to have_content('Abbott & Costello | Blacklight')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'includes analytics reporting' do
|
51
|
-
expect(rendered).to have_content 'analytics'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'does not include the page title' do
|
56
|
-
allow(page).to receive_messages(should_display_title?: false)
|
57
|
-
expect(view).not_to receive(:set_html_page_title)
|
58
|
-
render
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'renders attributes in <p>' do
|
62
|
-
render
|
63
|
-
expect(rendered).to match(/Title/)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'renders the sidebar' do
|
67
|
-
page.display_sidebar = true
|
68
|
-
render
|
69
|
-
expect(view.content_for(:sidebar)).to match('Sidebar')
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'does not render the sidebar if the page has it disabled' do
|
73
|
-
allow(page).to receive_messages(display_sidebar?: false)
|
74
|
-
render
|
75
|
-
expect(view.content_for(:sidebar)).not_to match('Sidebar')
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'renders an empty partial if the page has no content' do
|
79
|
-
allow(page).to receive_messages(content?: false)
|
80
|
-
stub_template 'spotlight/pages/_empty.html.erb' => 'Empty message'
|
81
|
-
render
|
82
|
-
expect(rendered).to have_content('Empty message')
|
83
|
-
end
|
84
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/resources/_external_resources_form.html.erb', type: :view do
|
4
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(view).to receive_messages(blacklight_config: blacklight_config)
|
9
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
10
|
-
allow(view).to receive_messages(current_page?: true)
|
11
|
-
# Assumes that the second backend is the "Simple"
|
12
|
-
I18n.backend.backends.second.store_translations(
|
13
|
-
:en,
|
14
|
-
a: {
|
15
|
-
title: 'a_title'
|
16
|
-
},
|
17
|
-
b: {
|
18
|
-
title: 'b_title'
|
19
|
-
},
|
20
|
-
c: {
|
21
|
-
title: 'c_title'
|
22
|
-
}
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'renders the configured partials' do
|
27
|
-
allow(Spotlight::Engine.config).to receive(:external_resources_partials).and_return(%w[a b c])
|
28
|
-
stub_template '_a.html.erb' => 'a_template'
|
29
|
-
stub_template '_b.html.erb' => 'b_template'
|
30
|
-
stub_template '_c.html.erb' => 'c_template'
|
31
|
-
render
|
32
|
-
expect(rendered).to have_content 'a_template'
|
33
|
-
expect(rendered).to have_content 'b_template'
|
34
|
-
expect(rendered).to have_content 'c_template'
|
35
|
-
end
|
36
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/resources/new.html.erb', type: :view do
|
4
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
|
-
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(view).to receive_messages(blacklight_config: blacklight_config)
|
9
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
10
|
-
allow(view).to receive_messages(current_page?: true)
|
11
|
-
stub_template 'spotlight/shared/_curation_sidebar.html.erb' => ''
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'renders the configured partials' do
|
15
|
-
allow(Spotlight::Engine.config).to receive(:resource_partials).and_return(
|
16
|
-
%w[
|
17
|
-
spotlight/resources/external_resources_form
|
18
|
-
spotlight/resources/upload/form
|
19
|
-
spotlight/resources/csv_upload/form
|
20
|
-
]
|
21
|
-
)
|
22
|
-
stub_template 'spotlight/resources/_external_resources_form.html.erb' => 'a_template'
|
23
|
-
stub_template 'spotlight/resources/upload/_form.html.erb' => 'b_template'
|
24
|
-
stub_template 'spotlight/resources/csv_upload/_form.html.erb' => 'c_template'
|
25
|
-
render
|
26
|
-
expect(rendered).to have_content 'a_template'
|
27
|
-
expect(rendered).to have_content 'b_template'
|
28
|
-
expect(rendered).to have_content 'c_template'
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/roles/index', type: :view do
|
4
|
-
let(:user) { stub_model(Spotlight::Engine.user_class, email: 'jane@example.com') }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
let(:admin_role) { FactoryBot.create(:role, role: 'admin', user: user, resource: exhibit) }
|
7
|
-
let(:roles) { [admin_role] }
|
8
|
-
|
9
|
-
before do
|
10
|
-
assign(:exhibit, exhibit)
|
11
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
12
|
-
allow(exhibit).to receive(:roles).and_return roles
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'renders the index page form' do
|
16
|
-
render
|
17
|
-
|
18
|
-
action = spotlight.update_all_exhibit_roles_path(exhibit)
|
19
|
-
assert_select "form[action='#{action}'][method='post']" do
|
20
|
-
assert_select "tr[data-show-for='#{admin_role.id}']"
|
21
|
-
assert_select "tr[data-edit-for='#{admin_role.id}']"
|
22
|
-
assert_select 'td', /jane@example.com/
|
23
|
-
assert_select 'td', 'Admin'
|
24
|
-
assert_select "input[type='submit'][data-behavior='destroy-user'][data-target='#{admin_role.id}']"
|
25
|
-
assert_select "input[type='hidden'][data-destroy-for='#{admin_role.id}']"
|
26
|
-
assert_select "a[data-behavior='cancel-edit']"
|
27
|
-
assert_select "input[type='submit'][value='Save changes']"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/search_configurations/_facet_metadata', type: :view do
|
4
|
-
let(:field_config) { nil }
|
5
|
-
let(:blacklight_config) { nil }
|
6
|
-
|
7
|
-
before do
|
8
|
-
render partial: 'spotlight/search_configurations/facet_metadata', locals: {
|
9
|
-
blacklight_config: blacklight_config,
|
10
|
-
field_config: field_config,
|
11
|
-
metadata: metadata
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'with a facet without any documents' do
|
16
|
-
let(:metadata) { { document_count: 0 } }
|
17
|
-
|
18
|
-
it 'shows there are no documents' do
|
19
|
-
expect(rendered).to have_content '0 items'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with a facet with a small number of values' do
|
24
|
-
let(:metadata) { { document_count: 1, value_count: 3, terms: %w[a b c] } }
|
25
|
-
|
26
|
-
it 'shows the number of unique values' do
|
27
|
-
expect(rendered).to have_content '1 item'
|
28
|
-
expect(rendered).to have_content '3 unique values'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'with a facet with a large number of values' do
|
33
|
-
let(:metadata) { { document_count: 1, value_count: 21, terms: %w[] } }
|
34
|
-
|
35
|
-
it 'shows there are many unique values' do
|
36
|
-
expect(rendered).to have_content '20+ unique values'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'with a facet with a configured limit' do
|
41
|
-
let(:metadata) { { document_count: 1, value_count: 10, terms: %w[] } }
|
42
|
-
let(:field_config) { Blacklight::Configuration::FacetField.new(limit: 10) }
|
43
|
-
|
44
|
-
it 'shows there are many unique values' do
|
45
|
-
expect(rendered).to have_content '10+ unique values'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'with a facet with an implicit limit' do
|
50
|
-
let(:blacklight_config) { CatalogController.blacklight_config }
|
51
|
-
let(:metadata) { { document_count: 1, value_count: 13, terms: %w[] } }
|
52
|
-
let(:field_config) { Blacklight::Configuration::FacetField.new(limit: true) }
|
53
|
-
|
54
|
-
it 'shows there are many unique values' do
|
55
|
-
expect(rendered).to have_content '10+ unique values'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/search_configurations/_facets', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let!(:custom_field) { FactoryBot.create(:custom_field, exhibit: exhibit, label: 'Foobar', field_type: 'vocab') }
|
6
|
-
let(:config) do
|
7
|
-
exhibit.blacklight_configuration
|
8
|
-
end
|
9
|
-
let(:field_metadata) { double('field_metadata') }
|
10
|
-
let(:empty_facet) { { document_count: 0, value_count: 0, terms: [] } }
|
11
|
-
let(:nonempty_facet) { { document_count: 1, value_count: 3, terms: %w[a b c] } }
|
12
|
-
let(:f) do
|
13
|
-
form_helper = nil
|
14
|
-
controller.view_context.bootstrap_form_for(config, url: '/update') do |f|
|
15
|
-
form_helper = f
|
16
|
-
end
|
17
|
-
form_helper
|
18
|
-
end
|
19
|
-
|
20
|
-
before do
|
21
|
-
assign(:blacklight_configuration, config)
|
22
|
-
allow(view).to receive_messages(current_exhibit: exhibit,
|
23
|
-
blacklight_config: config.blacklight_config)
|
24
|
-
allow(field_metadata).to receive(:field).with(any_args).and_return(nonempty_facet)
|
25
|
-
allow(field_metadata).to receive(:field).with('genre_ssim').and_return(empty_facet)
|
26
|
-
allow(field_metadata).to receive(:field).with(custom_field.field).and_return(empty_facet)
|
27
|
-
assign(:field_metadata, field_metadata)
|
28
|
-
render partial: 'spotlight/search_configurations/facets', locals: { f: f }
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'shows the config for the non-empty personal name facet' do
|
32
|
-
expect(rendered).to have_content 'Personal names'
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'shows the config for the empty custom facet' do
|
36
|
-
expect(rendered).to have_content 'Foobar'
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'hides the config for the empty genre facet' do
|
40
|
-
expect(rendered).not_to have_content 'Genre'
|
41
|
-
end
|
42
|
-
|
43
|
-
describe do
|
44
|
-
before do
|
45
|
-
original_config = Spotlight::Engine.blacklight_config.deep_dup
|
46
|
-
allow(Spotlight::Engine).to receive(:blacklight_config).and_return(original_config)
|
47
|
-
original_config.add_facet_field 'some_hidden_field', if: ->(*_args) { false }
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'hides the config facets configured not to display' do
|
51
|
-
expect(rendered).not_to have_content 'Some hidden field'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/search_configurations/_search_fields', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:f) do
|
6
|
-
form_helper = nil
|
7
|
-
controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f|
|
8
|
-
form_helper = f
|
9
|
-
end
|
10
|
-
form_helper
|
11
|
-
end
|
12
|
-
|
13
|
-
before do
|
14
|
-
original_config = Spotlight::Engine.blacklight_config.deep_dup
|
15
|
-
allow(Spotlight::Engine).to receive(:blacklight_config).and_return(original_config)
|
16
|
-
original_config.add_search_field 'some_field_with_a_condition', if: ->(*_args) { false }
|
17
|
-
assign(:exhibit, exhibit)
|
18
|
-
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
19
|
-
allow(view).to receive_messages(current_exhibit: exhibit)
|
20
|
-
exhibit.blacklight_config.add_search_field 'some_hidden_field', include_in_simple_select: false
|
21
|
-
exhibit.blacklight_config.add_search_field 'some_field with_a_space'
|
22
|
-
render partial: 'spotlight/search_configurations/search_fields', locals: { f: f }
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has a fieldset with an appropriate legend' do
|
26
|
-
expect(rendered).to have_selector 'fieldset legend', text: 'Field-based search'
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has a checkbox to enable or disable fielded search' do
|
30
|
-
expect(rendered).to have_selector 'input[data-behavior="enable-feature"][data-target="#search_fields"]'
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has a read-only "everything" search option' do
|
34
|
-
expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][all_fields][enabled]'][data-readonly='true']"
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'has search options for available search fields' do
|
38
|
-
expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][title][enabled]']"
|
39
|
-
expect(rendered).to have_selector "input[name='blacklight_configuration[search_fields][author][enabled]']"
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'excludes search options that do not show up in the search dropdown' do
|
43
|
-
expect(rendered).not_to have_selector "input[name='blacklight_configuration[search_fields][autocomplete][enabled]']"
|
44
|
-
expect(rendered).not_to have_selector "input[name='blacklight_configuration[search_fields][some_hidden_field][enabled]']"
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'excludes search options that have if/unless configuration that causes them not to be displayed' do
|
48
|
-
expect(rendered).not_to have_selector "input[name='blacklight_configuration[search_fields][some_field_with_a_condition][enabled]']"
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'parameterizes the data-id attribute for search field key' do
|
52
|
-
expect(rendered).to have_selector '[data-id="some_field-with_a_space"]'
|
53
|
-
end
|
54
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe 'spotlight/search_configurations/_sort', type: :view do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:f) do
|
6
|
-
form_helper = nil
|
7
|
-
controller.view_context.bootstrap_form_for(exhibit.blacklight_configuration, url: '/update') do |f|
|
8
|
-
form_helper = f
|
9
|
-
end
|
10
|
-
form_helper
|
11
|
-
end
|
12
|
-
|
13
|
-
before do
|
14
|
-
original_config = Spotlight::Engine.blacklight_config.deep_dup
|
15
|
-
allow(Spotlight::Engine).to receive(:blacklight_config).and_return(original_config)
|
16
|
-
original_config.add_sort_field 'some_disabled_field', if: ->(*_args) { false }
|
17
|
-
exhibit.blacklight_config.add_sort_field 'sort_title_ssi asc, plus_another_field desc', label: 'TestSort'
|
18
|
-
assign(:exhibit, exhibit)
|
19
|
-
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
20
|
-
allow(view).to receive_messages(
|
21
|
-
current_exhibit: exhibit,
|
22
|
-
translate_sort_fields: ''
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'has a disabled relevance sort option' do
|
27
|
-
render partial: 'spotlight/search_configurations/sort', locals: { f: f }
|
28
|
-
expect(rendered).to have_selector "input[name='blacklight_configuration[sort_fields][relevance][enable]'][disabled='disabled']"
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'parameterizes the data-id attribute for sort fields (e.g. when no key is supplied and the sort is used as the key)' do
|
32
|
-
render partial: 'spotlight/search_configurations/sort', locals: { f: f }
|
33
|
-
expect(rendered).to have_css('[data-id="sort_title_ssi-asc-plus_another_field-desc"]')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'hides fields that are configured not to display' do
|
37
|
-
render partial: 'spotlight/search_configurations/sort', locals: { f: f }
|
38
|
-
expect(rendered).not_to have_css('[data-id="some_disabled_field"]')
|
39
|
-
end
|
40
|
-
end
|