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,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::BrowseCategorySearchBuilder do
|
4
|
-
class BrowseCategoryMockSearchBuilder < Blacklight::SearchBuilder
|
5
|
-
include Blacklight::Solr::SearchBuilderBehavior
|
6
|
-
include Spotlight::BrowseCategorySearchBuilder
|
7
|
-
end
|
8
|
-
|
9
|
-
subject { BrowseCategoryMockSearchBuilder.new(scope).with(blacklight_params) }
|
10
|
-
|
11
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
12
|
-
let(:scope) do
|
13
|
-
double(blacklight_config: exhibit.blacklight_config, current_exhibit: exhibit, search_state_class: nil)
|
14
|
-
end
|
15
|
-
let(:solr_request) { Blacklight::Solr::Request.new }
|
16
|
-
let(:blacklight_params) { { browse_category_id: search.id } }
|
17
|
-
let(:search) { FactoryBot.create(:search, exhibit: exhibit, query_params: { sort: 'type', f: { genre_ssim: ['term'] }, q: 'search query' }) }
|
18
|
-
|
19
|
-
describe '#restrict_to_browse_category' do
|
20
|
-
it 'adds the search query parameters from the browse category' do
|
21
|
-
params = subject.to_hash.with_indifferent_access
|
22
|
-
|
23
|
-
expect(params).to include(
|
24
|
-
q: 'search query',
|
25
|
-
fq: ['{!term f=genre_ssim}term'],
|
26
|
-
sort: 'sort_type_ssi asc'
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'with a user-provided query' do
|
31
|
-
let(:blacklight_params) { { browse_category_id: search.id, q: 'cats' } }
|
32
|
-
|
33
|
-
it 'uses the user-provided query to further restrict the search' do
|
34
|
-
params = subject.to_hash.with_indifferent_access
|
35
|
-
expect(params).not_to include(:q)
|
36
|
-
expect(params).to include(
|
37
|
-
json: {
|
38
|
-
query: {
|
39
|
-
bool: {
|
40
|
-
must: [
|
41
|
-
{ edismax: { query: 'cats' } },
|
42
|
-
{ edismax: { query: 'search query' } }
|
43
|
-
]
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactEmail, type: :model do
|
4
|
-
subject { described_class.new(exhibit: exhibit) }
|
5
|
-
|
6
|
-
let(:exhibit) { FactoryBot.build_stubbed(:exhibit) }
|
7
|
-
|
8
|
-
it { is_expected.not_to be_valid }
|
9
|
-
|
10
|
-
describe 'with an invalid email set' do
|
11
|
-
before { subject.email = '@-foo' }
|
12
|
-
|
13
|
-
it 'does not be valid' do
|
14
|
-
expect(subject).not_to be_valid
|
15
|
-
expect(subject.errors[:email]).to eq ['is not valid']
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'with a valid email set' do
|
20
|
-
before { subject.email = 'foo@example.com' }
|
21
|
-
|
22
|
-
it { is_expected.to be_valid }
|
23
|
-
|
24
|
-
describe '#send_devise_notification' do
|
25
|
-
it 'sends stuff' do
|
26
|
-
expect do
|
27
|
-
subject.send(:send_devise_notification, :confirmation_instructions, 'Q7PEPdLVxymsQL2_s_Rg', {})
|
28
|
-
end.to change { ActionMailer::Base.deliveries.count }.by(1)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '.confirmed' do
|
34
|
-
it 'scopes contacts to only confirmed contacts' do
|
35
|
-
a = exhibit.contact_emails.create(email: 'a@example.com')
|
36
|
-
if a.respond_to? :confirm
|
37
|
-
a.confirm
|
38
|
-
else
|
39
|
-
a.confirm!
|
40
|
-
end
|
41
|
-
|
42
|
-
b = exhibit.contact_emails.create(email: 'b@example.com')
|
43
|
-
|
44
|
-
expect(described_class.confirmed.to_a).to include a
|
45
|
-
expect(described_class.confirmed.to_a).not_to include b
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactForm do
|
4
|
-
subject { described_class.new(name: 'Root', email: 'user@example.com') }
|
5
|
-
|
6
|
-
let(:exhibit) { FactoryBot.build_stubbed(:exhibit) }
|
7
|
-
let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field }
|
8
|
-
|
9
|
-
describe 'the email subject' do
|
10
|
-
it 'has a subject' do
|
11
|
-
expect(subject.headers[:subject]).to eq 'Blacklight exhibit feedback'
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with a current exhibit' do
|
15
|
-
before do
|
16
|
-
subject.current_exhibit = exhibit
|
17
|
-
exhibit.title = 'My exhibit'
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'uses the site title in the email' do
|
21
|
-
expect(subject.headers[:subject]).to eq 'My exhibit exhibit feedback'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'with a site title' do
|
26
|
-
before do
|
27
|
-
Spotlight::Site.instance.update(title: 'Exhibits')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'uses the site title in the email' do
|
31
|
-
expect(subject.headers[:subject]).to eq 'Exhibits exhibit feedback'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'with a site-wide contact email' do
|
37
|
-
before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
|
38
|
-
|
39
|
-
it 'sends the email to the configured contact' do
|
40
|
-
expect(subject.headers[:to]).to eq Spotlight::Engine.config.default_contact_email
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'with exhibit-specific contacts' do
|
44
|
-
before do
|
45
|
-
subject.current_exhibit = exhibit
|
46
|
-
exhibit.contact_emails.create(email: 'curator@example.com', confirmed_at: Time.zone.now)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'appends exhibit-specific contacts as cc recipients' do
|
50
|
-
expect(subject.headers[:cc]).to eq 'curator@example.com'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context 'with exhibit-specific contacts' do
|
56
|
-
before do
|
57
|
-
subject.current_exhibit = exhibit
|
58
|
-
exhibit.contact_emails.create(email: 'curator@example.com', confirmed_at: Time.zone.now)
|
59
|
-
exhibit.contact_emails.create(email: 'addl_curator@example.com', confirmed_at: Time.zone.now)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'sends the email to the first contact' do
|
63
|
-
expect(subject.headers[:to]).to eq 'curator@example.com'
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'appends exhibit-specific contacts as cc recipients' do
|
67
|
-
expect(subject.headers[:cc]).to eq 'curator@example.com, addl_curator@example.com'
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'when validating feedback submission fields' do
|
72
|
-
it 'allows submissions that set a valid email address' do
|
73
|
-
subject.email = 'user@legitimatebusinesspersonssocialclub.biz'
|
74
|
-
subject.send("#{honeypot_field_name}=", '')
|
75
|
-
expect(subject).to be_valid
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'rejects submissions that set an invalid email address' do
|
79
|
-
subject.email = 'user'
|
80
|
-
subject.send("#{honeypot_field_name}=", '')
|
81
|
-
expect(subject).not_to be_valid
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'allows submissions that leave the spammer honeypot field blank' do
|
85
|
-
subject.send("#{honeypot_field_name}=", '')
|
86
|
-
expect(subject).to be_valid
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'rejects submissions that set the spammer honeypot field' do
|
90
|
-
subject.send("#{honeypot_field_name}=", 'spam@spam.com')
|
91
|
-
expect(subject).not_to be_valid
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactImage do
|
4
|
-
subject(:contact_image) do
|
5
|
-
described_class.new(iiif_tilesource: 'http://example.com/iiif/abc123/info.json')
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'has the appropriate contact image size' do
|
9
|
-
expect(contact_image.iiif_url).to match(%r{/full/70,70/})
|
10
|
-
end
|
11
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::Contact, type: :model do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
|
6
|
-
before do
|
7
|
-
subject.exhibit = exhibit
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#show_in_sidebar' do
|
11
|
-
it 'is an attribute' do
|
12
|
-
subject.show_in_sidebar = false
|
13
|
-
subject.save
|
14
|
-
expect(subject.show_in_sidebar).to be_falsey
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'is published by default' do
|
18
|
-
subject.save
|
19
|
-
expect(subject.show_in_sidebar).to be_truthy
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#fields' do
|
24
|
-
it 'show allow new fields to be configured' do
|
25
|
-
expect(subject.class.fields).not_to have_key(:new_field)
|
26
|
-
described_class.fields[:new_field] = {}
|
27
|
-
expect(subject.class.fields).to have_key(:new_field)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#contact_info' do
|
32
|
-
it 'persisted symbolized keys' do
|
33
|
-
subject.contact_info = { 'some' => 'value' }
|
34
|
-
subject.save
|
35
|
-
expect(subject.contact_info).to include some: 'value'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,204 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CustomField, type: :model do
|
4
|
-
describe '#label' do
|
5
|
-
subject { described_class.new configuration: { 'label' => 'the configured label' }, field: 'foo_tesim' }
|
6
|
-
|
7
|
-
describe "when the exhibit doesn't have a config" do
|
8
|
-
its(:label) { is_expected.to eq 'the configured label' }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'when the exhibit has a config' do
|
12
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
13
|
-
|
14
|
-
before { subject.exhibit = exhibit }
|
15
|
-
|
16
|
-
describe 'that overrides the label' do
|
17
|
-
before do
|
18
|
-
exhibit.blacklight_configuration.index_fields['foo_tesim'] = { 'label' => 'overridden' }
|
19
|
-
end
|
20
|
-
|
21
|
-
its(:label) { is_expected.to eq 'overridden' }
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "that doesn't override the label" do
|
25
|
-
its(:label) { is_expected.to eq 'the configured label' }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#label=' do
|
31
|
-
subject { described_class.new field: 'foo_tesim' }
|
32
|
-
|
33
|
-
describe "when the exhibit doesn't have a config" do
|
34
|
-
before { subject.label = 'the configured label' }
|
35
|
-
|
36
|
-
its(:configuration) { is_expected.to eq('label' => 'the configured label') }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'when the exhibit has a config' do
|
40
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
41
|
-
|
42
|
-
before { subject.exhibit = exhibit }
|
43
|
-
|
44
|
-
describe 'that overrides the label' do
|
45
|
-
before do
|
46
|
-
exhibit.blacklight_configuration.index_fields['foo_tesim'] = { 'label' => 'overridden' }
|
47
|
-
subject.label = 'edited'
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'has updated the exhibit' do
|
51
|
-
expect(subject.exhibit.blacklight_configuration.index_fields['foo_tesim']['label']).to eq 'edited'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#field' do
|
58
|
-
let(:exhibit) { double(to_param: 'a', solr_document_sidecars: Spotlight::SolrDocumentSidecar.none) }
|
59
|
-
|
60
|
-
before do
|
61
|
-
subject.label = 'xyz'
|
62
|
-
subject.save
|
63
|
-
|
64
|
-
allow(Spotlight::RenameSidecarFieldJob).to receive(:perform_later)
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'is auto-generated from the field label' do
|
68
|
-
expect(subject.field).to start_with 'xyz'
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'ends in the text suffix if it is a text field' do
|
72
|
-
subject.field_type = 'text'
|
73
|
-
subject.save
|
74
|
-
expect(subject.field).to end_with '_tesim'
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'ends in a string suffix if it is a vocab field' do
|
78
|
-
subject.field_type = 'vocab'
|
79
|
-
subject.save
|
80
|
-
expect(subject.field).to end_with '_ssim'
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'begins with readonly if it is readonly' do
|
84
|
-
subject.readonly_field = true
|
85
|
-
subject.save
|
86
|
-
expect(subject.field).to start_with('readonly_')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe '#solr_field' do
|
91
|
-
subject { custom_field.solr_field }
|
92
|
-
|
93
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
94
|
-
let(:custom_field) do
|
95
|
-
described_class.create(exhibit: exhibit, configuration: { 'label' => 'xyz' })
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'is auto-generated from the field label' do
|
99
|
-
expect(subject).to eq "exhibit_#{exhibit.to_param}_xyz_tesim"
|
100
|
-
end
|
101
|
-
|
102
|
-
context 'with a solr field prefix configured' do
|
103
|
-
before do
|
104
|
-
allow(Spotlight::Engine.config.solr_fields).to receive(:prefix).and_return 'prefix_'
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'uses the solr field prefix' do
|
108
|
-
expect(subject).to eq "prefix_exhibit_#{exhibit.to_param}_xyz_tesim"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
context 'for a legacy solr field name' do
|
113
|
-
before do
|
114
|
-
custom_field.field = "exhibit_#{exhibit.to_param}_xyz_tesim"
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'returns the original field name' do
|
118
|
-
expect(subject).to eq "exhibit_#{exhibit.to_param}_xyz_tesim"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe '#configured_to_display?' do
|
124
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
125
|
-
|
126
|
-
before do
|
127
|
-
exhibit.blacklight_configuration.blacklight_config.view = { view_name: {} }
|
128
|
-
subject.exhibit = exhibit
|
129
|
-
subject.label = 'Label'
|
130
|
-
subject.field = 'foo_tesim'
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'is truthy when a view has been configured true' do
|
134
|
-
exhibit.blacklight_configuration.blacklight_config.index_fields['foo_tesim'] =
|
135
|
-
Blacklight::Configuration::IndexField.new(label: 'Label', enabled: true, view_name: true)
|
136
|
-
subject.save
|
137
|
-
|
138
|
-
expect(subject).to be_configured_to_display
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'is truthey for show views when enabled' do
|
142
|
-
exhibit.blacklight_configuration.blacklight_config.index_fields['foo_tesim'] =
|
143
|
-
Blacklight::Configuration::IndexField.new(label: 'Label', enabled: true, show: true)
|
144
|
-
subject.save
|
145
|
-
|
146
|
-
expect(subject).to be_configured_to_display
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'is falsey when a few has not been configured true' do
|
150
|
-
exhibit.blacklight_configuration.blacklight_config.index_fields['foo_tesim'] =
|
151
|
-
Blacklight::Configuration::IndexField.new(label: 'Label', enabled: true, view_name: false)
|
152
|
-
subject.save
|
153
|
-
|
154
|
-
expect(subject).not_to be_configured_to_display
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'is falsey when the field is not enabled' do
|
158
|
-
exhibit.blacklight_configuration.index_fields['foo_tesim'] = { 'label' => 'overridden', enabled: false, view_name: false }
|
159
|
-
subject.save
|
160
|
-
|
161
|
-
expect(subject).not_to be_configured_to_display
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
describe 'changing the field type' do
|
166
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
167
|
-
|
168
|
-
before do
|
169
|
-
subject.label = 'xyz'
|
170
|
-
subject.exhibit = exhibit
|
171
|
-
subject.save!
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'changes the field name for the field' do
|
175
|
-
expect(subject.field).to end_with 'tesim'
|
176
|
-
subject.field_type = 'vocab'
|
177
|
-
subject.save
|
178
|
-
expect(subject.field).to end_with 'ssim'
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'copies index field configuration to the new field name' do
|
182
|
-
subject.exhibit.blacklight_configuration.index_fields_will_change!
|
183
|
-
subject.exhibit.blacklight_configuration.index_fields[subject.field] = { value: true }
|
184
|
-
subject.exhibit.blacklight_configuration.save
|
185
|
-
expect(subject.exhibit.blacklight_configuration.index_fields).to have_key subject.field
|
186
|
-
|
187
|
-
subject.field_type = 'vocab'
|
188
|
-
subject.save
|
189
|
-
expect(subject.exhibit.blacklight_configuration.index_fields).to have_key subject.field
|
190
|
-
expect(subject.exhibit.blacklight_configuration.index_fields[subject.field]).to include value: true
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'queues a job to reindex any documents with data in the old field' do
|
194
|
-
expect(Spotlight::RenameSidecarFieldJob).to receive(:perform_later).with(
|
195
|
-
exhibit,
|
196
|
-
subject.field, subject.field.sub('tesim', 'ssim'),
|
197
|
-
subject.slug, subject.slug
|
198
|
-
)
|
199
|
-
|
200
|
-
subject.field_type = 'vocab'
|
201
|
-
subject.save
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CustomSearchField, type: :model do
|
4
|
-
describe '#label' do
|
5
|
-
subject { described_class.new configuration: { 'label' => 'the configured label' }, slug: 'foo' }
|
6
|
-
|
7
|
-
describe "when the exhibit doesn't have a config" do
|
8
|
-
its(:label) { is_expected.to eq 'the configured label' }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'when the exhibit has a config' do
|
12
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
13
|
-
|
14
|
-
before { subject.exhibit = exhibit }
|
15
|
-
|
16
|
-
describe 'that overrides the label' do
|
17
|
-
before do
|
18
|
-
exhibit.blacklight_configuration.search_fields['foo'] = { 'label' => 'overridden' }
|
19
|
-
end
|
20
|
-
|
21
|
-
its(:label) { is_expected.to eq 'overridden' }
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "that doesn't override the label" do
|
25
|
-
its(:label) { is_expected.to eq 'the configured label' }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#label=' do
|
31
|
-
subject { described_class.new slug: 'foo' }
|
32
|
-
|
33
|
-
describe "when the exhibit doesn't have a config" do
|
34
|
-
before { subject.label = 'the configured label' }
|
35
|
-
|
36
|
-
its(:configuration) { is_expected.to eq('label' => 'the configured label') }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'when the exhibit has a config' do
|
40
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
41
|
-
|
42
|
-
before { subject.exhibit = exhibit }
|
43
|
-
|
44
|
-
describe 'that overrides the label' do
|
45
|
-
before do
|
46
|
-
exhibit.blacklight_configuration.search_fields['foo'] = { 'label' => 'overridden' }
|
47
|
-
subject.label = 'edited'
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'has updated the exhibit' do
|
51
|
-
expect(subject.exhibit.blacklight_configuration.search_fields['foo']['label']).to eq 'edited'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CustomTranslationExtension do
|
4
|
-
subject do
|
5
|
-
Class.new(ActiveRecord::Base) do
|
6
|
-
include Spotlight::CustomTranslationExtension
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
11
|
-
|
12
|
-
describe '.current_exhibit' do
|
13
|
-
it 'sets the current exhibit' do
|
14
|
-
subject.current_exhibit = exhibit
|
15
|
-
expect(subject.current_exhibit).to eq exhibit
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'reloads the i18n' do
|
19
|
-
allow(I18n.backend).to receive(:reload!)
|
20
|
-
|
21
|
-
subject.current_exhibit = exhibit
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|