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.
Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spotlight/roles_controller.rb +1 -1
  3. data/lib/spotlight/version.rb +1 -1
  4. metadata +6 -610
  5. data/spec/controllers/application_controller_spec.rb +0 -30
  6. data/spec/controllers/spotlight/about_pages_controller_spec.rb +0 -239
  7. data/spec/controllers/spotlight/admin_users_controller_spec.rb +0 -53
  8. data/spec/controllers/spotlight/appearances_controller_spec.rb +0 -88
  9. data/spec/controllers/spotlight/application_controller_spec.rb +0 -11
  10. data/spec/controllers/spotlight/attachments_controller_spec.rb +0 -28
  11. data/spec/controllers/spotlight/browse_controller_spec.rb +0 -133
  12. data/spec/controllers/spotlight/bulk_actions_controller_spec.rb +0 -124
  13. data/spec/controllers/spotlight/bulk_updates_controller_spec.rb +0 -77
  14. data/spec/controllers/spotlight/catalog_controller_spec.rb +0 -552
  15. data/spec/controllers/spotlight/confirmations_controller_spec.rb +0 -38
  16. data/spec/controllers/spotlight/contact_email_controller_spec.rb +0 -65
  17. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +0 -38
  18. data/spec/controllers/spotlight/contacts_controller_spec.rb +0 -103
  19. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +0 -62
  20. data/spec/controllers/spotlight/custom_search_fields_controller_spec.rb +0 -62
  21. data/spec/controllers/spotlight/dashboards_controller_spec.rb +0 -68
  22. data/spec/controllers/spotlight/exhibits_controller_spec.rb +0 -216
  23. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -251
  24. data/spec/controllers/spotlight/featured_images_controller_spec.rb +0 -77
  25. data/spec/controllers/spotlight/filters_controller_spec.rb +0 -72
  26. data/spec/controllers/spotlight/groups_controller_spec.rb +0 -103
  27. data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -126
  28. data/spec/controllers/spotlight/job_trackers_controller_spec.rb +0 -37
  29. data/spec/controllers/spotlight/languages_controller_spec.rb +0 -70
  30. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +0 -93
  31. data/spec/controllers/spotlight/pages_controller_spec.rb +0 -50
  32. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +0 -71
  33. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +0 -55
  34. data/spec/controllers/spotlight/resources_controller_spec.rb +0 -85
  35. data/spec/controllers/spotlight/roles_controller_spec.rb +0 -141
  36. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +0 -141
  37. data/spec/controllers/spotlight/searches_controller_spec.rb +0 -195
  38. data/spec/controllers/spotlight/sites_controller_spec.rb +0 -67
  39. data/spec/controllers/spotlight/solr_controller_spec.rb +0 -116
  40. data/spec/controllers/spotlight/tags_controller_spec.rb +0 -56
  41. data/spec/controllers/spotlight/translations_controller_spec.rb +0 -132
  42. data/spec/controllers/spotlight/versions_controller_spec.rb +0 -56
  43. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +0 -35
  44. data/spec/examples.txt +0 -1515
  45. data/spec/factories/bulk_updates.rb +0 -21
  46. data/spec/factories/contact_emails.rb +0 -8
  47. data/spec/factories/contact_images.rb +0 -8
  48. data/spec/factories/contacts.rb +0 -11
  49. data/spec/factories/custom_fields.rb +0 -9
  50. data/spec/factories/custom_search_fields.rb +0 -9
  51. data/spec/factories/exhibit_thumbnails.rb +0 -8
  52. data/spec/factories/exhibits.rb +0 -17
  53. data/spec/factories/featured_images.rb +0 -16
  54. data/spec/factories/group.rb +0 -17
  55. data/spec/factories/job_trackers.rb +0 -11
  56. data/spec/factories/language.rb +0 -8
  57. data/spec/factories/main_navigation.rb +0 -9
  58. data/spec/factories/pages.rb +0 -34
  59. data/spec/factories/resources.rb +0 -14
  60. data/spec/factories/roles.rb +0 -9
  61. data/spec/factories/searches.rb +0 -33
  62. data/spec/factories/tags.rb +0 -14
  63. data/spec/factories/translation.rb +0 -8
  64. data/spec/factories/users.rb +0 -50
  65. data/spec/features/about_page_spec.rb +0 -46
  66. data/spec/features/add_contacts_spec.rb +0 -63
  67. data/spec/features/add_custom_field_metadata_spec.rb +0 -88
  68. data/spec/features/add_iiif_manifest_spec.rb +0 -46
  69. data/spec/features/add_items_spec.rb +0 -135
  70. data/spec/features/autocomplete_typeahead_spec.rb +0 -89
  71. data/spec/features/browse_category_admin_spec.rb +0 -163
  72. data/spec/features/browse_category_navigation_spec.rb +0 -44
  73. data/spec/features/browse_category_spec.rb +0 -158
  74. data/spec/features/bulk_actions_spec.rb +0 -72
  75. data/spec/features/catalog_spec.rb +0 -57
  76. data/spec/features/confirm_email_spec.rb +0 -21
  77. data/spec/features/create_exhibit_spec.rb +0 -65
  78. data/spec/features/create_page_spec.rb +0 -21
  79. data/spec/features/dashboard_spec.rb +0 -34
  80. data/spec/features/edit_contact_spec.rb +0 -21
  81. data/spec/features/edit_search_fields_spec.rb +0 -79
  82. data/spec/features/exhibit_masthead_spec.rb +0 -112
  83. data/spec/features/exhibit_themes_spec.rb +0 -30
  84. data/spec/features/exhibits/add_tags_spec.rb +0 -35
  85. data/spec/features/exhibits/administration_spec.rb +0 -141
  86. data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -97
  87. data/spec/features/exhibits/custom_search_fields_spec.rb +0 -55
  88. data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -49
  89. data/spec/features/exhibits/language_create_edit_spec.rb +0 -59
  90. data/spec/features/exhibits/translation_editing_spec.rb +0 -463
  91. data/spec/features/exhibits_index_spec.rb +0 -55
  92. data/spec/features/feature_page_spec.rb +0 -155
  93. data/spec/features/home_page_spec.rb +0 -102
  94. data/spec/features/import_exhibit_spec.rb +0 -58
  95. data/spec/features/item_admin_spec.rb +0 -59
  96. data/spec/features/javascript/about_page_admin_spec.rb +0 -21
  97. data/spec/features/javascript/block_controls_spec.rb +0 -42
  98. data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +0 -64
  99. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -46
  100. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -61
  101. data/spec/features/javascript/blocks/link_to_search_block_spec.rb +0 -46
  102. data/spec/features/javascript/blocks/rule_block_spec.rb +0 -23
  103. data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -47
  104. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -232
  105. data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +0 -29
  106. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -94
  107. data/spec/features/javascript/browse_group_admin_spec.rb +0 -45
  108. data/spec/features/javascript/edit_in_place_spec.rb +0 -93
  109. data/spec/features/javascript/feature_page_admin_spec.rb +0 -140
  110. data/spec/features/javascript/home_page_edit_spec.rb +0 -34
  111. data/spec/features/javascript/locale_selector_spec.rb +0 -66
  112. data/spec/features/javascript/metadata_admin_spec.rb +0 -41
  113. data/spec/features/javascript/multi_image_select_spec.rb +0 -50
  114. data/spec/features/javascript/reindex_monitor_spec.rb +0 -23
  115. data/spec/features/javascript/roles_admin_spec.rb +0 -38
  116. data/spec/features/javascript/search_config_admin_spec.rb +0 -140
  117. data/spec/features/javascript/search_context_spec.rb +0 -88
  118. data/spec/features/main_navigation_spec.rb +0 -96
  119. data/spec/features/metadata_admin_spec.rb +0 -18
  120. data/spec/features/report_a_problem_spec.rb +0 -62
  121. data/spec/features/site_masthead_spec.rb +0 -91
  122. data/spec/features/site_users_management_spec.rb +0 -74
  123. data/spec/features/slideshow_spec.rb +0 -21
  124. data/spec/features/translation_scope_spec.rb +0 -27
  125. data/spec/fixtures/800x600.png +0 -0
  126. data/spec/fixtures/avatar.png +0 -0
  127. data/spec/fixtures/bulk-update-template.csv +0 -57
  128. data/spec/fixtures/csv-upload-fixture.csv +0 -4
  129. data/spec/fixtures/gk446cj2442-manifest.json +0 -58
  130. data/spec/fixtures/iiif_responses.rb +0 -312
  131. data/spec/fixtures/json-upload-fixture.json +0 -3
  132. data/spec/fixtures/sample_solr_documents.yml +0 -9385
  133. data/spec/fixtures/updated-bulk-update-template-no-cols.csv +0 -4
  134. data/spec/fixtures/updated-bulk-update-template-w-tags.csv +0 -4
  135. data/spec/fixtures/updated-bulk-update-template.csv +0 -4
  136. data/spec/helpers/spotlight/application_helper_spec.rb +0 -196
  137. data/spec/helpers/spotlight/browse_helper_spec.rb +0 -13
  138. data/spec/helpers/spotlight/crop_helper_spec.rb +0 -11
  139. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -163
  140. data/spec/helpers/spotlight/languages_helper_spec.rb +0 -79
  141. data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -101
  142. data/spec/helpers/spotlight/masthead_helper_spec.rb +0 -51
  143. data/spec/helpers/spotlight/meta_helper_spec.rb +0 -33
  144. data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -24
  145. data/spec/helpers/spotlight/pages_helper_spec.rb +0 -123
  146. data/spec/helpers/spotlight/roles_helper_spec.rb +0 -7
  147. data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -23
  148. data/spec/helpers/spotlight/title_helper_spec.rb +0 -64
  149. data/spec/helpers/spotlight/translations_helper_spec.rb +0 -16
  150. data/spec/i18n_spec.rb +0 -27
  151. data/spec/jobs/spotlight/add_tags_job_spec.rb +0 -34
  152. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +0 -58
  153. data/spec/jobs/spotlight/change_visibility_job_spec.rb +0 -30
  154. data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -14
  155. data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +0 -86
  156. data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +0 -43
  157. data/spec/jobs/spotlight/reindex_job_spec.rb +0 -79
  158. data/spec/jobs/spotlight/remove_tags_job_spec.rb +0 -39
  159. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -33
  160. data/spec/lib/migration/iiif_spec.rb +0 -91
  161. data/spec/lib/migration/page_language_spec.rb +0 -25
  162. data/spec/lib/spotlight/catalog_spec.rb +0 -0
  163. data/spec/lib/spotlight/controller_spec.rb +0 -102
  164. data/spec/lib/spotlight/upload_field_config_spec.rb +0 -40
  165. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -42
  166. data/spec/models/sir_trevor_rails/block_spec.rb +0 -72
  167. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -42
  168. data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +0 -41
  169. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +0 -50
  170. data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +0 -23
  171. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -59
  172. data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -42
  173. data/spec/models/solr_document_spec.rb +0 -214
  174. data/spec/models/spotlight/ability_spec.rb +0 -118
  175. data/spec/models/spotlight/about_page_spec.rb +0 -19
  176. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -82
  177. data/spec/models/spotlight/analytics/ga_spec.rb +0 -22
  178. data/spec/models/spotlight/background_job_progress_spec.rb +0 -137
  179. data/spec/models/spotlight/blacklight_configuration_spec.rb +0 -649
  180. data/spec/models/spotlight/browse_category_search_builder_spec.rb +0 -51
  181. data/spec/models/spotlight/contact_email_spec.rb +0 -48
  182. data/spec/models/spotlight/contact_form_spec.rb +0 -94
  183. data/spec/models/spotlight/contact_image_spec.rb +0 -11
  184. data/spec/models/spotlight/contact_spec.rb +0 -38
  185. data/spec/models/spotlight/custom_field_spec.rb +0 -204
  186. data/spec/models/spotlight/custom_search_field_spec.rb +0 -56
  187. data/spec/models/spotlight/custom_translation_extension_spec.rb +0 -24
  188. data/spec/models/spotlight/exhibit_spec.rb +0 -383
  189. data/spec/models/spotlight/exhibit_thumbnail_spec.rb +0 -10
  190. data/spec/models/spotlight/feature_page_spec.rb +0 -87
  191. data/spec/models/spotlight/featured_image_spec.rb +0 -110
  192. data/spec/models/spotlight/field_metadata_spec.rb +0 -58
  193. data/spec/models/spotlight/filter_spec.rb +0 -19
  194. data/spec/models/spotlight/group_spec.rb +0 -19
  195. data/spec/models/spotlight/home_page_spec.rb +0 -38
  196. data/spec/models/spotlight/language_spec.rb +0 -42
  197. data/spec/models/spotlight/main_navigation_spec.rb +0 -19
  198. data/spec/models/spotlight/masthead_spec.rb +0 -45
  199. data/spec/models/spotlight/page_configurations_spec.rb +0 -45
  200. data/spec/models/spotlight/page_spec.rb +0 -293
  201. data/spec/models/spotlight/resource_spec.rb +0 -137
  202. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +0 -52
  203. data/spec/models/spotlight/resources/iiif_manifest_spec.rb +0 -178
  204. data/spec/models/spotlight/resources/iiif_service_spec.rb +0 -57
  205. data/spec/models/spotlight/resources/upload_spec.rb +0 -71
  206. data/spec/models/spotlight/resources/web_spec.rb +0 -25
  207. data/spec/models/spotlight/role_spec.rb +0 -51
  208. data/spec/models/spotlight/search_spec.rb +0 -125
  209. data/spec/models/spotlight/site_spec.rb +0 -9
  210. data/spec/models/spotlight/sitemap_spec.rb +0 -113
  211. data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -56
  212. data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -38
  213. data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -48
  214. data/spec/models/spotlight/user_spec.rb +0 -26
  215. data/spec/models/translation_spec.rb +0 -26
  216. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +0 -132
  217. data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -34
  218. data/spec/routing/spotlight/featured_images_spec.rb +0 -23
  219. data/spec/routing/spotlight/pages_routing_spec.rb +0 -42
  220. data/spec/services/spotlight/bulk_updates_csv_template_service_spec.rb +0 -26
  221. data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +0 -16
  222. data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +0 -30
  223. data/spec/services/spotlight/etl/context_spec.rb +0 -66
  224. data/spec/services/spotlight/etl/executor_spec.rb +0 -149
  225. data/spec/services/spotlight/etl/pipeline_spec.rb +0 -22
  226. data/spec/services/spotlight/etl/solr_loader_spec.rb +0 -76
  227. data/spec/services/spotlight/etl/step_spec.rb +0 -70
  228. data/spec/services/spotlight/exhibit_import_export_service_spec.rb +0 -569
  229. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +0 -94
  230. data/spec/services/spotlight/invite_users_service_spec.rb +0 -47
  231. data/spec/spec_helper.rb +0 -146
  232. data/spec/support/controllers/engine_helpers.rb +0 -9
  233. data/spec/support/disable_friendly_id_deprecation_warnings.rb +0 -11
  234. data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +0 -20
  235. data/spec/support/features/test_features_helpers.rb +0 -92
  236. data/spec/support/helpers/controller_level_helpers.rb +0 -25
  237. data/spec/support/stub_iiif_response.rb +0 -26
  238. data/spec/support/views/test_view_helpers.rb +0 -21
  239. data/spec/test_app_templates/Gemfile.extra +0 -2
  240. data/spec/test_app_templates/carrierwave.rb +0 -8
  241. data/spec/test_app_templates/catalog_controller.rb +0 -108
  242. data/spec/test_app_templates/fixture.css +0 -0
  243. data/spec/test_app_templates/fixture.png +0 -0
  244. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -71
  245. data/spec/test_app_templates/spotlight_test.rake +0 -14
  246. data/spec/uploaders/spotlight/attachment_uploader_spec.rb +0 -27
  247. data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +0 -33
  248. data/spec/views/shared/_analytics.html.erb_spec.rb +0 -17
  249. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -127
  250. data/spec/views/shared/_header_navbar.html.erb_spec.rb +0 -12
  251. data/spec/views/shared/_masthead.html.erb_spec.rb +0 -91
  252. data/spec/views/shared/_user_util_links.html.erb_spec.rb +0 -102
  253. data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -28
  254. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -24
  255. data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -69
  256. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -30
  257. data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -22
  258. data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -65
  259. data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -63
  260. data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +0 -39
  261. data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -20
  262. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -43
  263. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -45
  264. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +0 -94
  265. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -33
  266. data/spec/views/spotlight/exhibits/_exhibit_card.html.erb_spec.rb +0 -46
  267. data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +0 -38
  268. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +0 -29
  269. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +0 -140
  270. data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -28
  271. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -45
  272. data/spec/views/spotlight/featured_images/_form.html.erb_spec.rb +0 -32
  273. data/spec/views/spotlight/featured_images/_upload_form.html.erb_spec.rb +0 -32
  274. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -28
  275. data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -12
  276. data/spec/views/spotlight/job_trackers/show.html.erb_spec.rb +0 -65
  277. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +0 -30
  278. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +0 -23
  279. data/spec/views/spotlight/pages/_form.html.erb_spec.rb +0 -20
  280. data/spec/views/spotlight/pages/edit.html.erb_spec.rb +0 -68
  281. data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -42
  282. data/spec/views/spotlight/pages/new.html.erb_spec.rb +0 -21
  283. data/spec/views/spotlight/pages/show.html.erb_spec.rb +0 -84
  284. data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -36
  285. data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -30
  286. data/spec/views/spotlight/roles/index.html.erb_spec.rb +0 -30
  287. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +0 -58
  288. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +0 -54
  289. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +0 -54
  290. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +0 -40
  291. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -37
  292. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -40
  293. data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -33
  294. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -20
  295. data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -20
  296. data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +0 -20
  297. data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -10
  298. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -43
  299. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -34
  300. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -53
  301. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -54
  302. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -42
  303. data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +0 -25
  304. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -27
  305. data/spec/views/spotlight/translations/_import.html.erb_spec.rb +0 -24
  306. data/spec/views/spotlight/translations/_page.html.erb_spec.rb +0 -76
@@ -1,649 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::BlacklightConfiguration, type: :model do
4
- subject { described_class.new }
5
-
6
- let(:blacklight_config) { Blacklight::Configuration.new }
7
-
8
- before do
9
- blacklight_config.configure do |config|
10
- config.add_sort_field 'relevance', sort: 'score desc, sort_title_ssi asc', label: 'Relevance'
11
- config.add_sort_field 'title', sort: 'sort_title_ssi asc', label: 'Title'
12
- config.add_sort_field 'type', sort: 'sort_type_ssi asc', label: 'Type'
13
- config.add_sort_field 'date', sort: 'sort_date_dtsi asc', label: 'Date'
14
- config.add_sort_field 'source', sort: 'sort_source_ssi asc', label: 'Source'
15
- config.add_sort_field 'identifier', sort: 'id asc', label: 'Identifier'
16
- end
17
- allow(subject).to receive_messages default_blacklight_config: blacklight_config
18
- subject.exhibit = FactoryBot.create(:exhibit)
19
- end
20
-
21
- it 'is expected to be versioned' do
22
- expect(subject).to be_versioned
23
- end
24
-
25
- it 'touches the exhibit' do
26
- expect(subject.exhibit).to receive :touch
27
- subject.save!
28
- end
29
-
30
- it 'adds a default thumbnail field' do
31
- expect(subject.blacklight_config.index.thumbnail_field).to eq Spotlight::Engine.config.thumbnail_field
32
- end
33
-
34
- describe 'facet fields' do
35
- it 'has facet fields' do
36
- expect(subject.facet_fields).to be_empty
37
- subject.facet_fields['title_facet'] = {}
38
- subject.facet_fields['author_facet'] = {}
39
- expect(subject.facet_fields.keys).to eq %w[title_facet author_facet]
40
- end
41
-
42
- it 'filters blank values' do
43
- subject.facet_fields['title_facet'] = { something: '' }
44
- subject.valid?
45
- expect(subject.facet_fields['title_facet'].keys).not_to include :something
46
- end
47
-
48
- it 'filters the upstream blacklight config' do
49
- subject.facet_fields['a'] = { show: true }
50
- subject.facet_fields['b'] = { show: false }
51
- subject.facet_fields['d'] = { show: true }
52
-
53
- blacklight_config.add_facet_field 'a'
54
- blacklight_config.add_facet_field 'b'
55
- blacklight_config.add_facet_field 'c'
56
-
57
- expect(subject.blacklight_config.facet_fields['a'].show).to be_truthy
58
- expect(subject.blacklight_config.facet_fields['a'].enabled).to be_truthy
59
- expect(subject.blacklight_config.facet_fields['b'].show).to be_falsey
60
- expect(subject.blacklight_config.facet_fields['b'].enabled).to be_falsey
61
- expect(subject.blacklight_config.facet_fields['d']).to be_nil
62
- end
63
-
64
- it 'orders the fields by weight' do
65
- subject.facet_fields['a'] = { show: true, weight: 3 }
66
- subject.facet_fields['b'] = { show: true, weight: 5 }
67
- subject.facet_fields['c'] = { show: true, weight: 1 }
68
-
69
- blacklight_config.add_facet_field 'a'
70
- blacklight_config.add_facet_field 'b'
71
- blacklight_config.add_facet_field 'c'
72
-
73
- expect(subject.blacklight_config.facet_fields.keys).to eq %w[c a b]
74
- end
75
-
76
- it 'allows the facet sort to be configured' do
77
- subject.facet_fields['a'] = { sort: 'count' }
78
- subject.facet_fields['b'] = { sort: 'index' }
79
-
80
- blacklight_config.add_facet_field 'a'
81
- blacklight_config.add_facet_field 'b'
82
-
83
- expect(subject.blacklight_config.facet_fields['a'].sort).to eq 'count'
84
- expect(subject.blacklight_config.facet_fields['b'].sort).to eq 'index'
85
- end
86
-
87
- it 'respects upstream configuration that disables the field entirely' do
88
- blacklight_config.add_facet_field 'a', if: false
89
- expect(subject.blacklight_config.facet_fields['a'].if).to eq false
90
- end
91
-
92
- context 'custom fields' do
93
- it 'includes any custom fields' do
94
- allow(subject).to receive_messages(custom_facet_fields: { 'a' => double(if: nil, :if= => true, merge!: true, validate!: true, normalize!: true) })
95
- expect(subject.blacklight_config.facet_fields).to include('a')
96
- end
97
-
98
- it 'defaults to not showing a custom field in the facets' do
99
- field = double('field', new_record?: false, field: 'a', solr_field: 'a', configuration: {})
100
- custom_fields = double('custom_fields', facetable: [field], reject: [])
101
- allow(custom_fields).to receive(:map).and_yield(field)
102
- allow(subject.exhibit).to receive(:custom_fields).and_return(custom_fields)
103
- subject.facet_fields = { 'a' => { enabled: '1', label: 'Label' } }
104
- expect(subject.blacklight_config.facet_fields).to include('a')
105
- expect(subject.blacklight_config.facet_fields['a'].show).to be_falsey
106
- expect(subject.blacklight_config.facet_fields['a'].if).to eq :field_enabled?
107
- expect(subject.blacklight_config.facet_fields['a'].enabled).to eq false
108
- expect(subject.blacklight_config.facet_fields['a'].limit).to eq true
109
- expect(subject.blacklight_config.facet_fields['a'].original).to be_blank
110
- end
111
-
112
- it 'allows the application configuration to override custom field configuration' do
113
- blacklight_config.add_index_field 'a', some_param: true, enabled: false
114
- subject.exhibit.custom_fields.create! field: 'a'
115
-
116
- expect(subject.blacklight_config.index_fields['a'].custom_field).to eq true
117
- expect(subject.blacklight_config.index_fields['a'].some_param).to eq true
118
- expect(subject.blacklight_config.index_fields['a'].enabled).to eq false
119
- end
120
- end
121
-
122
- context 'exhibit fields' do
123
- before do
124
- # undo the stubbing we've used elsewhere..
125
- allow(subject).to receive(:default_blacklight_config).and_call_original
126
- allow(Spotlight::Engine).to receive_messages blacklight_config: blacklight_config
127
- end
128
-
129
- it 'injects a tags facet' do
130
- expect(subject.blacklight_config.facet_fields).to include 'exhibit_tags'
131
- end
132
- end
133
- end
134
-
135
- describe 'index fields' do
136
- it 'has index fields' do
137
- expect(subject.index_fields).to be_empty
138
- subject.index_fields['title'] = {}
139
- subject.index_fields['author'] = {}
140
- expect(subject.index_fields.keys).to eq %w[title author]
141
- end
142
-
143
- it 'defaults to displaying all index fields if no exhibit-specific configuration is set' do
144
- blacklight_config.add_index_field 'a'
145
- blacklight_config.add_index_field 'b'
146
- blacklight_config.add_index_field 'c'
147
-
148
- expect(subject.blacklight_config.index_fields['a'].enabled).to be_truthy
149
- expect(subject.blacklight_config.index_fields['a'].list).to be_truthy
150
- expect(subject.blacklight_config.index_fields['b'].enabled).to be_truthy
151
- expect(subject.blacklight_config.index_fields['b'].list).to be_truthy
152
- expect(subject.blacklight_config.index_fields['c'].enabled).to be_truthy
153
- expect(subject.blacklight_config.index_fields['c'].list).to be_truthy
154
- end
155
-
156
- it 'honors field specfic display settings set in the field configuration' do
157
- blacklight_config.add_index_field 'a'
158
- blacklight_config.add_index_field 'b', list: false
159
-
160
- expect(subject.blacklight_config.index_fields['a'].list).to be_truthy
161
- expect(subject.blacklight_config.index_fields['b'].list).to be_falsey
162
- end
163
-
164
- it 'filters upstream fields that are always disabled' do
165
- blacklight_config.add_index_field 'a', if: false
166
- expect(subject.blacklight_config.index_fields).not_to have_key 'a'
167
- end
168
-
169
- it 'filters blank values' do
170
- subject.index_fields['title'] = { something: '' }
171
- subject.valid?
172
- expect(subject.index_fields['title'].keys).not_to include :something
173
- end
174
-
175
- it 'filters the upstream blacklight config' do
176
- subject.index_fields['a'] = { enabled: true, list: true }
177
- subject.index_fields['c'] = { enabled: false, list: false }
178
- subject.index_fields['d'] = { enabled: true, list: true }
179
-
180
- blacklight_config.add_index_field 'a'
181
- blacklight_config.add_index_field 'b'
182
- blacklight_config.add_index_field 'c'
183
-
184
- expect(subject.blacklight_config.index_fields['a'].enabled).to be_truthy
185
- expect(subject.blacklight_config.index_fields['a'].list).to be_truthy
186
- expect(subject.blacklight_config.index_fields['b'].enabled).to be_falsey
187
- expect(subject.blacklight_config.index_fields['b'].list).to be_falsey
188
- expect(subject.blacklight_config.index_fields['d']).to be_nil
189
- end
190
-
191
- it 'includes configured show fields, but disable them for index views' do
192
- blacklight_config.add_show_field 'a'
193
- expect(subject.blacklight_config.index_fields).to have_key 'a'
194
- expect(subject.blacklight_config.index_fields['a'].enabled).to be_truthy
195
- expect(subject.blacklight_config.index_fields['a'].show).to be_truthy
196
- expect(subject.blacklight_config.index_fields['a'].list).to be_falsey
197
- end
198
-
199
- it 'filters show fields that are always disabled' do
200
- blacklight_config.add_show_field 'a', if: false
201
- expect(subject.blacklight_config.index_fields).not_to have_key 'a'
202
- end
203
-
204
- it 'includes persisted configurations for show fields' do
205
- subject.index_fields['a'] = { enabled: true, list: true }
206
- blacklight_config.add_show_field 'a'
207
- expect(subject.blacklight_config.index_fields).to have_key 'a'
208
- expect(subject.blacklight_config.index_fields['a'].enabled).to be_truthy
209
- expect(subject.blacklight_config.index_fields['a'].list).to be_truthy
210
- end
211
-
212
- it 'applies immutable values from the configuration' do
213
- blacklight_config.add_index_field 'a', immutable: { something: 'set_in_configuration', another: 'immutable' }
214
- subject.index_fields['a'] = { something: 'set_in_db' }
215
- expect(subject.blacklight_config.index_fields['a'].something).to eq 'set_in_configuration'
216
- expect(subject.blacklight_config.index_fields['a'].another).to eq 'immutable'
217
- end
218
-
219
- context 'custom fields' do
220
- it 'includes any custom fields' do
221
- subject.index_fields['a'] = { enabled: true, list: true }
222
- allow(subject).to receive_messages(custom_index_fields: { 'a' => Blacklight::Configuration::IndexField.new(field: 'a') })
223
- expect(subject.blacklight_config.index_fields).to include('a')
224
- end
225
-
226
- it 'defaults to showing a custom field on the show view' do
227
- allow(subject).to receive_messages(custom_index_fields: { 'a' => Blacklight::Configuration::IndexField.new(field: 'a') })
228
- expect(subject.blacklight_config.index_fields).to include('a')
229
- expect(subject.blacklight_config.index_fields['a'].show).to be_truthy
230
- expect(subject.blacklight_config.index_fields['a'].enabled).to be_truthy
231
- end
232
-
233
- it 'uses explicit configuration to override custom field defaults' do
234
- subject.index_fields['a'] = { show: false }
235
- allow(subject).to receive_messages(custom_index_fields: { 'a' => Blacklight::Configuration::IndexField.new(field: 'a') })
236
- expect(subject.blacklight_config.index_fields).to include('a')
237
- expect(subject.blacklight_config.index_fields['a'].show).to be_falsey
238
- end
239
- end
240
-
241
- it 'prefers the label stored in index fields' do
242
- subject.index_fields['a'] = { enabled: true, list: true, label: 'updated val' }
243
- allow(subject).to receive_messages(custom_index_fields: { 'a' => Blacklight::Configuration::IndexField.new(field: 'a', label: 'Initial value') })
244
- expect(subject.blacklight_config.index_fields['a'].label).to eq 'updated val'
245
- end
246
-
247
- it 'filters the upstream blacklight config with respect for view types' do
248
- subject.index_fields['a'] = { enabled: true, list: true, gallery: false }
249
- subject.index_fields['b'] = { enabled: true, list: false, gallery: true }
250
- subject.index_fields['c'] = { enabled: false, list: true, gallery: false }
251
- subject.index_fields['d'] = { enabled: true, list: false, gallery: true }
252
- subject.index_fields['e'] = { enabled: true, list: true, gallery: false }
253
-
254
- blacklight_config.add_index_field 'a'
255
- blacklight_config.add_index_field 'b'
256
- blacklight_config.add_index_field 'c'
257
- blacklight_config.add_index_field 'd'
258
-
259
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.list }).to include('a')
260
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.gallery }).to include('b', 'd')
261
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.list }).not_to include('b', 'd')
262
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.gallery }).not_to include('a', 'c')
263
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.list }).to have(2).fields
264
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.list && x.enabled }).to have(1).fields
265
- expect(subject.blacklight_config.index_fields.select { |_k, x| x.gallery }).to have(2).fields
266
- end
267
-
268
- it 'filters the upstream blacklight config for show fields' do
269
- subject.index_fields['a'] = { enabled: true, show: true }
270
- subject.index_fields['c'] = { enabled: false, show: false }
271
- subject.index_fields['d'] = { enabled: true, show: false }
272
-
273
- blacklight_config.add_index_field 'a'
274
- blacklight_config.add_index_field 'b'
275
- blacklight_config.add_index_field 'c'
276
-
277
- expect(subject.blacklight_config.show_fields.select { |_k, x| x.show && x.enabled }).to include('a')
278
- expect(subject.blacklight_config.show_fields.select { |_k, x| x.show && x.enabled }).not_to include('b', 'd')
279
- expect(subject.blacklight_config.show_fields.select { |_k, x| x.show && x.enabled }).to have(1).fields
280
- end
281
-
282
- it 'includes any custom fields' do
283
- subject.index_fields['a'] = { enabled: true, show: true }
284
-
285
- allow(subject).to receive_messages(custom_index_fields: { 'a' => Blacklight::Configuration::IndexField.new(field: 'a') })
286
-
287
- expect(subject.blacklight_config.show_fields).to include('a')
288
- end
289
-
290
- it 'orders the fields by weight' do
291
- subject.index_fields['a'] = { enabled: true, weight: 3, list: true }
292
- subject.index_fields['b'] = { enabled: true, weight: 5, list: true }
293
- subject.index_fields['c'] = { enabled: true, weight: 1, list: true }
294
-
295
- blacklight_config.add_show_field 'a'
296
- blacklight_config.add_index_field 'b'
297
- blacklight_config.add_index_field 'c'
298
-
299
- expect(subject.blacklight_config.index_fields.keys).to eq %w[c a b]
300
- end
301
-
302
- it 'orders the fields by weight' do
303
- subject.index_fields['a'] = { enabled: true, weight: 3, show: true }
304
- subject.index_fields['b'] = { enabled: true, weight: 5, show: true }
305
- subject.index_fields['c'] = { enabled: true, weight: 1, show: true }
306
-
307
- blacklight_config.add_index_field 'a'
308
- blacklight_config.add_index_field 'b'
309
- blacklight_config.add_index_field 'c'
310
-
311
- expect(subject.blacklight_config.show_fields.keys).to eq %w[c a b]
312
- end
313
-
314
- context 'title only configuration' do
315
- before do
316
- blacklight_config.configure do |config|
317
- config.view.gallery(title_only_by_default: true)
318
- config.add_index_field 'a'
319
- end
320
- end
321
-
322
- it 'only shows titles (i.e., no metadata) for gallery view' do
323
- expect(subject.blacklight_config.index_fields['a'][:list]).to eq true
324
- expect(subject.blacklight_config.index_fields['a'][:gallery]).to eq false
325
- end
326
- end
327
- end
328
-
329
- describe 'a newly created instance' do
330
- before do
331
- subject.save!
332
- end
333
-
334
- describe 'should have default values' do
335
- its(:sort_fields) do
336
- is_expected.to eq('identifier' => { enabled: true },
337
- 'relevance' => { enabled: true },
338
- 'date' => { enabled: true },
339
- 'source' => { enabled: true },
340
- 'title' => { enabled: true },
341
- 'type' => { enabled: true })
342
- end
343
-
344
- its(:search_fields) do
345
- is_expected.to eq('all_fields' => { enabled: true },
346
- 'title' => { enabled: true },
347
- 'author' => { enabled: true })
348
- end
349
-
350
- its(:default_per_page) { is_expected.to eq 10 }
351
- its(:document_index_view_types) { is_expected.to match_array ::CatalogController.blacklight_config.view.keys.map(&:to_s) }
352
- end
353
- end
354
-
355
- describe 'sort fields' do
356
- it 'has sort fields' do
357
- expect(subject.sort_fields).to be_empty
358
- subject.sort_fields['title'] = {}
359
- subject.sort_fields['author'] = {}
360
- expect(subject.sort_fields.keys).to eq %w[title author]
361
- end
362
-
363
- it 'filters blank values' do
364
- subject.sort_fields['title'] = { something: '' }
365
- subject.valid?
366
- expect(subject.sort_fields['title'].keys).not_to include :something
367
- end
368
-
369
- it 'filters the upstream blacklight config' do
370
- subject.sort_fields['a'] = { enabled: true }
371
- subject.sort_fields['c'] = { enabled: true }
372
- subject.sort_fields['d'] = { enabled: true }
373
-
374
- blacklight_config.add_sort_field 'a'
375
- blacklight_config.add_sort_field 'b'
376
- blacklight_config.add_sort_field 'c'
377
-
378
- expect(subject.blacklight_config.sort_fields.select { |_k, v| v.enabled == true }).to include('a', 'c')
379
- expect(subject.blacklight_config.sort_fields.select { |_k, v| v.enabled == true }).not_to include('b', 'd')
380
- end
381
-
382
- it 'is disabled when enabled = false' do
383
- blacklight_config.add_sort_field 'a', enabled: false
384
- expect(subject.blacklight_config.sort_fields['a'].enabled).to eq false
385
- end
386
- end
387
-
388
- describe 'search fields' do
389
- it 'has search fields' do
390
- expect(subject.search_fields).to be_empty
391
- subject.search_fields['title'] = {}
392
- subject.search_fields['author'] = {}
393
- expect(subject.search_fields.keys).to eq %w[title author]
394
- end
395
-
396
- it 'filters blank values' do
397
- subject.search_fields['title'] = { something: '' }
398
- subject.valid?
399
- expect(subject.search_fields['title'].keys).not_to include :something
400
- end
401
-
402
- it 'filters the upstream blacklight config' do
403
- subject.search_fields['a'] = { enabled: true }
404
- subject.search_fields['c'] = { enabled: true }
405
- subject.search_fields['d'] = { enabled: true }
406
-
407
- blacklight_config.add_search_field 'a'
408
- blacklight_config.add_search_field 'b'
409
- blacklight_config.add_search_field 'c'
410
-
411
- expect(subject.blacklight_config.search_fields.select { |_k, v| v.enabled == true }).to include('a', 'c')
412
- expect(subject.blacklight_config.search_fields.select { |_k, v| v.enabled == true }).not_to include('b', 'd')
413
- end
414
-
415
- it 'respects upstream configuration that disables the field entirely' do
416
- blacklight_config.add_search_field 'a', if: false
417
- expect(subject.blacklight_config.search_fields['a'].if).to eq false
418
- end
419
-
420
- it 'is disabled when enabled = false' do
421
- blacklight_config.add_search_field 'a', enabled: false
422
- expect(subject.blacklight_config.search_fields['a'].enabled).to eq false
423
- end
424
-
425
- context 'custom fields' do
426
- it 'includes any custom fields' do
427
- allow(subject).to receive_messages(custom_search_fields: { 'a' => Blacklight::Configuration::SearchField.new(field: 'a') })
428
- expect(subject.blacklight_config.search_fields).to include('a')
429
- end
430
- end
431
- end
432
-
433
- describe 'per page' do
434
- it 'has per page configuration' do
435
- expect(subject.per_page).to be_empty
436
- subject.per_page << 10 << 50
437
- expect(subject.per_page).to eq [10, 50]
438
- end
439
-
440
- it 'filters blank values' do
441
- subject.per_page << ''
442
- subject.valid?
443
- expect(subject.per_page).not_to include ''
444
- end
445
-
446
- it 'filters the upstream blacklight config' do
447
- subject.per_page = [10, 50, 1000]
448
- blacklight_config.per_page = [1, 10, 50, 100]
449
-
450
- expect(subject.blacklight_config.per_page).to eq [10, 50]
451
- end
452
- end
453
-
454
- describe '#default_per_page' do
455
- it 'is the first per page option by default' do
456
- expect(subject.blacklight_config.default_per_page).to eq 10
457
- end
458
-
459
- it "is set from the model's default_per_page" do
460
- subject.default_per_page = 50
461
- expect(subject.blacklight_config.default_per_page).to eq 50
462
- end
463
- end
464
-
465
- describe 'document_index_view_types' do
466
- it 'has index view configuration' do
467
- expect(subject.document_index_view_types).to be_empty
468
- subject.document_index_view_types << 'list' << 'gallery'
469
- expect(subject.document_index_view_types).to eq %w[list gallery]
470
- end
471
-
472
- it 'filters blank values' do
473
- subject.document_index_view_types << ''
474
- subject.valid?
475
- expect(subject.document_index_view_types).not_to include ''
476
- end
477
-
478
- # rubocop:disable RSpec/PredicateMatcher
479
- it 'filters the upstream blacklight config' do
480
- subject.document_index_view_types = %w[list gallery unknown]
481
- blacklight_config.view.list!
482
- blacklight_config.view.gallery!
483
- blacklight_config.view.something!
484
-
485
- expect(subject.blacklight_config.view.keys).to include :list, :gallery, :something
486
- expect(subject.blacklight_config.view.select { |k, v| v.key == k && v.if == :enabled_in_spotlight_view_type_configuration? }.any?).to be_truthy
487
- end
488
- # rubocop:enable RSpec/PredicateMatcher
489
-
490
- it 'passes through the blacklight configuration when not set' do
491
- blacklight_config.view.list!
492
- blacklight_config.view.gallery!
493
- blacklight_config.view.something!
494
- expect(subject.blacklight_config.view.keys.map(&:to_s)).to include(*blacklight_config.view.keys.map(&:to_s))
495
- end
496
- end
497
-
498
- describe 'default_solr_params' do
499
- it 'has default solr params configuration' do
500
- expect(subject.default_solr_params).to be_empty
501
- subject.default_solr_params[:qt] = 'custom_request_handler'
502
- expect(subject.default_solr_params[:qt]).to eq 'custom_request_handler'
503
- end
504
-
505
- it 'merges with the blacklight config' do
506
- blacklight_config.default_solr_params = { qt: 'xyz', rows: 10 }
507
- subject.default_solr_params[:qt] = 'abc'
508
- expect(subject.blacklight_config.default_solr_params).to include(:qt, :rows)
509
- expect(subject.blacklight_config.default_solr_params[:qt]).to eq 'abc'
510
- end
511
- end
512
-
513
- describe 'show' do
514
- it 'has show view configuration' do
515
- expect(subject.show).to be_empty
516
- subject.show[:key] = 'some value'
517
- expect(subject.show[:key]).to eq 'some value'
518
- end
519
-
520
- it 'merges with the blacklight config' do
521
- blacklight_config.show.title_field = 'xyz'
522
- subject.show[:title_field] = 'abc'
523
- expect(subject.blacklight_config.show.title_field).to eq 'abc'
524
- end
525
- end
526
-
527
- describe 'index' do
528
- it 'has index view configuration' do
529
- expect(subject.index).to be_empty
530
- subject.index[:key] = 'some value'
531
- expect(subject.index[:key]).to eq 'some value'
532
- end
533
-
534
- it 'merges with the blacklight config' do
535
- blacklight_config.index.title_field = 'xyz'
536
- subject.index[:title_field] = 'abc'
537
- expect(subject.blacklight_config.index.title_field).to eq 'abc'
538
- end
539
- end
540
-
541
- describe '#custom_facet_fields' do
542
- it 'converts exhibit-specific fields to Blacklight configurations' do
543
- allow(subject.exhibit).to receive_message_chain(:custom_fields, facetable: [
544
- stub_model(Spotlight::CustomField, field: 'abc', configuration: { a: 1 }, exhibit: subject.exhibit),
545
- stub_model(Spotlight::CustomField, field: 'xyz', configuration: { x: 2 }, exhibit: subject.exhibit)
546
- ])
547
-
548
- expect(subject.custom_facet_fields).to include 'abc', 'xyz'
549
- expect(subject.custom_facet_fields['abc']).to be_a_kind_of Blacklight::Configuration::Field
550
- expect(subject.custom_facet_fields['abc'].a).to eq 1
551
- expect(subject.custom_facet_fields['abc'].custom_field).to eq true
552
- end
553
- end
554
-
555
- describe '#custom_index_fields' do
556
- it 'converts exhibit-specific fields to Blacklight configurations' do
557
- allow(subject.exhibit).to receive_messages(custom_fields: [
558
- stub_model(Spotlight::CustomField, field: 'abc', configuration: { a: 1 }, exhibit: subject.exhibit),
559
- stub_model(Spotlight::CustomField, field: 'xyz', configuration: { x: 2 }, exhibit: subject.exhibit)
560
- ])
561
- custom_index_fields = subject.custom_index_fields(blacklight_config)
562
- expect(custom_index_fields).to include 'abc', 'xyz'
563
- expect(custom_index_fields['abc']).to be_a_kind_of Blacklight::Configuration::Field
564
- expect(custom_index_fields['abc'].a).to eq 1
565
- expect(custom_index_fields['abc'].custom_field).to eq true
566
- end
567
- end
568
-
569
- describe '#custom_search_fields' do
570
- it 'converts exhibit-specific fields to Blacklight configurations' do
571
- allow(subject.exhibit).to receive_messages(custom_search_fields: [
572
- stub_model(Spotlight::CustomSearchField, field: 'abc', slug: 'a', exhibit: subject.exhibit),
573
- stub_model(Spotlight::CustomSearchField, field: 'xyz', slug: 'b', exhibit: subject.exhibit)
574
- ])
575
- custom_search_fields = subject.custom_search_fields(blacklight_config)
576
- expect(custom_search_fields).to include 'a', 'b'
577
- expect(custom_search_fields['a']).to be_a_kind_of Blacklight::Configuration::Field
578
- expect(custom_search_fields['a'].solr_parameters).to eq(qf: 'abc')
579
- expect(custom_search_fields['a'].custom_field).to eq true
580
- end
581
- end
582
-
583
- describe 'autocomplete configuration' do
584
- before do
585
- # undo the stubbing we've used elsewhere..
586
- allow(subject).to receive(:default_blacklight_config).and_call_original
587
- blacklight_config.show.title_field = 'x'
588
- allow(Spotlight::Engine).to receive_messages blacklight_config: blacklight_config.deep_copy
589
- end
590
-
591
- context 'with the default search field' do
592
- let(:search_field) do
593
- subject.blacklight_config.search_fields[Spotlight::Engine.config.autocomplete_search_field]
594
- end
595
-
596
- it 'is hidden from the search field selector' do
597
- expect(search_field.if).to eq false
598
- end
599
-
600
- it "uses the engine's autocomplete parameters" do
601
- expect(search_field.solr_parameters).to include Spotlight::Engine.config.default_autocomplete_params
602
- end
603
-
604
- it 'includes the relevant fields' do
605
- Spotlight::Engine.blacklight_config.show.title_field = 'some_field'
606
- expect(search_field.solr_parameters).to have_key :fl
607
- expect(search_field.solr_parameters[:fl]).to include 'id'
608
- expect(search_field.solr_parameters[:fl]).to include 'some_field'
609
- expect(search_field.solr_parameters[:fl]).to include 'thumbnail_url_ssm'
610
- end
611
- end
612
- end
613
-
614
- describe '#document_index_view_types' do
615
- it 'passes arrays through' do
616
- array = [1, 2, 3]
617
- subject.document_index_view_types = array
618
- expect(subject.document_index_view_types).to match_array array
619
- end
620
-
621
- it 'is simplified from a hash to an array' do
622
- checkboxes_from_form = { 'list' => '1', 'gallery' => '1', 'map' => '0' }
623
- subject.document_index_view_types = checkboxes_from_form
624
- expect(subject.document_index_view_types).to match_array %w[list gallery]
625
- end
626
- end
627
-
628
- describe '#document_index_view_types_selected_hash' do
629
- before do
630
- subject.default_blacklight_config.view.list!
631
- subject.default_blacklight_config.view.gallery!
632
- subject.default_blacklight_config.view.whatever!
633
- subject.default_blacklight_config.view.rss.if = false
634
- subject.document_index_view_types = %w[list gallery rss]
635
- end
636
-
637
- it 'includes selected view types as the value true' do
638
- expect(subject.document_index_view_types_selected_hash.to_h).to include list: true, gallery: true
639
- end
640
-
641
- it 'disabled view types use the value false' do
642
- expect(subject.document_index_view_types_selected_hash.to_h).to include whatever: false
643
- end
644
-
645
- it 'excludes view types disabled by configuration (not by curator settings)' do
646
- expect(subject.document_index_view_types_selected_hash.to_h).not_to include :rss
647
- end
648
- end
649
- end