blacklight-spotlight 3.4.0 → 3.4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) 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 -579
  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/features/about_page_spec.rb +0 -46
  46. data/spec/features/add_contacts_spec.rb +0 -63
  47. data/spec/features/add_custom_field_metadata_spec.rb +0 -88
  48. data/spec/features/add_iiif_manifest_spec.rb +0 -46
  49. data/spec/features/add_items_spec.rb +0 -135
  50. data/spec/features/autocomplete_typeahead_spec.rb +0 -89
  51. data/spec/features/browse_category_admin_spec.rb +0 -163
  52. data/spec/features/browse_category_navigation_spec.rb +0 -44
  53. data/spec/features/browse_category_spec.rb +0 -158
  54. data/spec/features/bulk_actions_spec.rb +0 -72
  55. data/spec/features/catalog_spec.rb +0 -57
  56. data/spec/features/confirm_email_spec.rb +0 -21
  57. data/spec/features/create_exhibit_spec.rb +0 -65
  58. data/spec/features/create_page_spec.rb +0 -21
  59. data/spec/features/dashboard_spec.rb +0 -34
  60. data/spec/features/edit_contact_spec.rb +0 -21
  61. data/spec/features/edit_search_fields_spec.rb +0 -79
  62. data/spec/features/exhibit_masthead_spec.rb +0 -112
  63. data/spec/features/exhibit_themes_spec.rb +0 -30
  64. data/spec/features/exhibits/add_tags_spec.rb +0 -35
  65. data/spec/features/exhibits/administration_spec.rb +0 -141
  66. data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -97
  67. data/spec/features/exhibits/custom_search_fields_spec.rb +0 -55
  68. data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -49
  69. data/spec/features/exhibits/language_create_edit_spec.rb +0 -59
  70. data/spec/features/exhibits/translation_editing_spec.rb +0 -463
  71. data/spec/features/exhibits_index_spec.rb +0 -55
  72. data/spec/features/feature_page_spec.rb +0 -155
  73. data/spec/features/home_page_spec.rb +0 -102
  74. data/spec/features/import_exhibit_spec.rb +0 -58
  75. data/spec/features/item_admin_spec.rb +0 -59
  76. data/spec/features/javascript/about_page_admin_spec.rb +0 -21
  77. data/spec/features/javascript/block_controls_spec.rb +0 -42
  78. data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +0 -64
  79. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -46
  80. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -61
  81. data/spec/features/javascript/blocks/link_to_search_block_spec.rb +0 -46
  82. data/spec/features/javascript/blocks/rule_block_spec.rb +0 -23
  83. data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -47
  84. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -232
  85. data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +0 -29
  86. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -94
  87. data/spec/features/javascript/browse_group_admin_spec.rb +0 -45
  88. data/spec/features/javascript/edit_in_place_spec.rb +0 -93
  89. data/spec/features/javascript/feature_page_admin_spec.rb +0 -140
  90. data/spec/features/javascript/home_page_edit_spec.rb +0 -34
  91. data/spec/features/javascript/locale_selector_spec.rb +0 -66
  92. data/spec/features/javascript/metadata_admin_spec.rb +0 -41
  93. data/spec/features/javascript/multi_image_select_spec.rb +0 -50
  94. data/spec/features/javascript/reindex_monitor_spec.rb +0 -23
  95. data/spec/features/javascript/roles_admin_spec.rb +0 -38
  96. data/spec/features/javascript/search_config_admin_spec.rb +0 -140
  97. data/spec/features/javascript/search_context_spec.rb +0 -88
  98. data/spec/features/main_navigation_spec.rb +0 -96
  99. data/spec/features/metadata_admin_spec.rb +0 -18
  100. data/spec/features/report_a_problem_spec.rb +0 -62
  101. data/spec/features/site_masthead_spec.rb +0 -91
  102. data/spec/features/site_users_management_spec.rb +0 -74
  103. data/spec/features/slideshow_spec.rb +0 -21
  104. data/spec/features/translation_scope_spec.rb +0 -27
  105. data/spec/helpers/spotlight/application_helper_spec.rb +0 -196
  106. data/spec/helpers/spotlight/browse_helper_spec.rb +0 -13
  107. data/spec/helpers/spotlight/crop_helper_spec.rb +0 -11
  108. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -163
  109. data/spec/helpers/spotlight/languages_helper_spec.rb +0 -79
  110. data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -101
  111. data/spec/helpers/spotlight/masthead_helper_spec.rb +0 -51
  112. data/spec/helpers/spotlight/meta_helper_spec.rb +0 -33
  113. data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -24
  114. data/spec/helpers/spotlight/pages_helper_spec.rb +0 -123
  115. data/spec/helpers/spotlight/roles_helper_spec.rb +0 -7
  116. data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -23
  117. data/spec/helpers/spotlight/title_helper_spec.rb +0 -64
  118. data/spec/helpers/spotlight/translations_helper_spec.rb +0 -16
  119. data/spec/i18n_spec.rb +0 -27
  120. data/spec/jobs/spotlight/add_tags_job_spec.rb +0 -34
  121. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +0 -58
  122. data/spec/jobs/spotlight/change_visibility_job_spec.rb +0 -30
  123. data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -14
  124. data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +0 -86
  125. data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +0 -43
  126. data/spec/jobs/spotlight/reindex_job_spec.rb +0 -79
  127. data/spec/jobs/spotlight/remove_tags_job_spec.rb +0 -39
  128. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -33
  129. data/spec/lib/migration/iiif_spec.rb +0 -91
  130. data/spec/lib/migration/page_language_spec.rb +0 -25
  131. data/spec/lib/spotlight/catalog_spec.rb +0 -0
  132. data/spec/lib/spotlight/controller_spec.rb +0 -102
  133. data/spec/lib/spotlight/upload_field_config_spec.rb +0 -40
  134. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -42
  135. data/spec/models/sir_trevor_rails/block_spec.rb +0 -72
  136. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -42
  137. data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +0 -41
  138. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +0 -50
  139. data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +0 -23
  140. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -59
  141. data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -42
  142. data/spec/models/solr_document_spec.rb +0 -214
  143. data/spec/models/spotlight/ability_spec.rb +0 -118
  144. data/spec/models/spotlight/about_page_spec.rb +0 -19
  145. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -82
  146. data/spec/models/spotlight/analytics/ga_spec.rb +0 -22
  147. data/spec/models/spotlight/background_job_progress_spec.rb +0 -137
  148. data/spec/models/spotlight/blacklight_configuration_spec.rb +0 -649
  149. data/spec/models/spotlight/browse_category_search_builder_spec.rb +0 -51
  150. data/spec/models/spotlight/contact_email_spec.rb +0 -48
  151. data/spec/models/spotlight/contact_form_spec.rb +0 -94
  152. data/spec/models/spotlight/contact_image_spec.rb +0 -11
  153. data/spec/models/spotlight/contact_spec.rb +0 -38
  154. data/spec/models/spotlight/custom_field_spec.rb +0 -204
  155. data/spec/models/spotlight/custom_search_field_spec.rb +0 -56
  156. data/spec/models/spotlight/custom_translation_extension_spec.rb +0 -24
  157. data/spec/models/spotlight/exhibit_spec.rb +0 -383
  158. data/spec/models/spotlight/exhibit_thumbnail_spec.rb +0 -10
  159. data/spec/models/spotlight/feature_page_spec.rb +0 -87
  160. data/spec/models/spotlight/featured_image_spec.rb +0 -110
  161. data/spec/models/spotlight/field_metadata_spec.rb +0 -58
  162. data/spec/models/spotlight/filter_spec.rb +0 -19
  163. data/spec/models/spotlight/group_spec.rb +0 -19
  164. data/spec/models/spotlight/home_page_spec.rb +0 -38
  165. data/spec/models/spotlight/language_spec.rb +0 -42
  166. data/spec/models/spotlight/main_navigation_spec.rb +0 -19
  167. data/spec/models/spotlight/masthead_spec.rb +0 -45
  168. data/spec/models/spotlight/page_configurations_spec.rb +0 -45
  169. data/spec/models/spotlight/page_spec.rb +0 -293
  170. data/spec/models/spotlight/resource_spec.rb +0 -137
  171. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +0 -52
  172. data/spec/models/spotlight/resources/iiif_manifest_spec.rb +0 -178
  173. data/spec/models/spotlight/resources/iiif_service_spec.rb +0 -57
  174. data/spec/models/spotlight/resources/upload_spec.rb +0 -71
  175. data/spec/models/spotlight/resources/web_spec.rb +0 -25
  176. data/spec/models/spotlight/role_spec.rb +0 -51
  177. data/spec/models/spotlight/search_spec.rb +0 -125
  178. data/spec/models/spotlight/site_spec.rb +0 -9
  179. data/spec/models/spotlight/sitemap_spec.rb +0 -113
  180. data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -56
  181. data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -38
  182. data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -48
  183. data/spec/models/spotlight/user_spec.rb +0 -26
  184. data/spec/models/translation_spec.rb +0 -26
  185. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +0 -132
  186. data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -34
  187. data/spec/routing/spotlight/featured_images_spec.rb +0 -23
  188. data/spec/routing/spotlight/pages_routing_spec.rb +0 -42
  189. data/spec/services/spotlight/bulk_updates_csv_template_service_spec.rb +0 -26
  190. data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +0 -16
  191. data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +0 -30
  192. data/spec/services/spotlight/etl/context_spec.rb +0 -66
  193. data/spec/services/spotlight/etl/executor_spec.rb +0 -149
  194. data/spec/services/spotlight/etl/pipeline_spec.rb +0 -22
  195. data/spec/services/spotlight/etl/solr_loader_spec.rb +0 -76
  196. data/spec/services/spotlight/etl/step_spec.rb +0 -70
  197. data/spec/services/spotlight/exhibit_import_export_service_spec.rb +0 -569
  198. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +0 -94
  199. data/spec/services/spotlight/invite_users_service_spec.rb +0 -47
  200. data/spec/spec_helper.rb +0 -146
  201. data/spec/support/controllers/engine_helpers.rb +0 -9
  202. data/spec/support/disable_friendly_id_deprecation_warnings.rb +0 -11
  203. data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +0 -20
  204. data/spec/support/features/test_features_helpers.rb +0 -92
  205. data/spec/support/helpers/controller_level_helpers.rb +0 -25
  206. data/spec/support/stub_iiif_response.rb +0 -26
  207. data/spec/support/views/test_view_helpers.rb +0 -21
  208. data/spec/test_app_templates/Gemfile.extra +0 -2
  209. data/spec/test_app_templates/carrierwave.rb +0 -8
  210. data/spec/test_app_templates/catalog_controller.rb +0 -108
  211. data/spec/test_app_templates/fixture.css +0 -0
  212. data/spec/test_app_templates/fixture.png +0 -0
  213. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -71
  214. data/spec/test_app_templates/spotlight_test.rake +0 -14
  215. data/spec/uploaders/spotlight/attachment_uploader_spec.rb +0 -27
  216. data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +0 -33
  217. data/spec/views/shared/_analytics.html.erb_spec.rb +0 -17
  218. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -127
  219. data/spec/views/shared/_header_navbar.html.erb_spec.rb +0 -12
  220. data/spec/views/shared/_masthead.html.erb_spec.rb +0 -91
  221. data/spec/views/shared/_user_util_links.html.erb_spec.rb +0 -102
  222. data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -28
  223. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -24
  224. data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -69
  225. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -30
  226. data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -22
  227. data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -65
  228. data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -63
  229. data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +0 -39
  230. data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -20
  231. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -43
  232. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -45
  233. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +0 -94
  234. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -33
  235. data/spec/views/spotlight/exhibits/_exhibit_card.html.erb_spec.rb +0 -46
  236. data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +0 -38
  237. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +0 -29
  238. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +0 -140
  239. data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -28
  240. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -45
  241. data/spec/views/spotlight/featured_images/_form.html.erb_spec.rb +0 -32
  242. data/spec/views/spotlight/featured_images/_upload_form.html.erb_spec.rb +0 -32
  243. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -28
  244. data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -12
  245. data/spec/views/spotlight/job_trackers/show.html.erb_spec.rb +0 -65
  246. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +0 -30
  247. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +0 -23
  248. data/spec/views/spotlight/pages/_form.html.erb_spec.rb +0 -20
  249. data/spec/views/spotlight/pages/edit.html.erb_spec.rb +0 -68
  250. data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -42
  251. data/spec/views/spotlight/pages/new.html.erb_spec.rb +0 -21
  252. data/spec/views/spotlight/pages/show.html.erb_spec.rb +0 -84
  253. data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -36
  254. data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -30
  255. data/spec/views/spotlight/roles/index.html.erb_spec.rb +0 -30
  256. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +0 -58
  257. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +0 -54
  258. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +0 -54
  259. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +0 -40
  260. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -37
  261. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -40
  262. data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -33
  263. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -20
  264. data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -20
  265. data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +0 -20
  266. data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -10
  267. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -43
  268. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -34
  269. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -53
  270. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -54
  271. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -42
  272. data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +0 -25
  273. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -27
  274. data/spec/views/spotlight/translations/_import.html.erb_spec.rb +0 -24
  275. data/spec/views/spotlight/translations/_page.html.erb_spec.rb +0 -76
@@ -1,101 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::MainAppHelpers, type: :helper do
4
- describe '#show_contact_form?' do
5
- subject { helper }
6
-
7
- let(:exhibit) { FactoryBot.create :exhibit }
8
- let(:exhibit_with_contacts) { FactoryBot.create :exhibit }
9
-
10
- context 'with an exhibit with confirmed contacts' do
11
- before do
12
- exhibit_with_contacts.contact_emails.create(email: 'cabeer@stanford.edu').tap do |e|
13
- if e.respond_to? :confirm
14
- e.confirm
15
- else
16
- e.confirm!
17
- end
18
- end
19
- end
20
-
21
- before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
22
-
23
- its(:show_contact_form?) { is_expected.to be_truthy }
24
- end
25
-
26
- context 'with an exhibit with only unconfirmed contacts' do
27
- before { exhibit_with_contacts.contact_emails.build email: 'cabeer@stanford.edu' }
28
-
29
- before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
30
-
31
- its(:show_contact_form?) { is_expected.to be_falsey }
32
- end
33
-
34
- context 'with an exhibit without contacts' do
35
- before { allow(helper).to receive_messages current_exhibit: exhibit }
36
-
37
- its(:show_contact_form?) { is_expected.to be_falsey }
38
- end
39
-
40
- context 'outside the context of an exhibit' do
41
- before { allow(helper).to receive_messages current_exhibit: nil }
42
-
43
- its(:show_contact_form?) { is_expected.to be_falsey }
44
- end
45
-
46
- context 'with a default contact address' do
47
- before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
48
-
49
- before { allow(helper).to receive_messages current_exhibit: exhibit }
50
-
51
- its(:show_contact_form?) { is_expected.to be_truthy }
52
- end
53
- end
54
-
55
- describe '#exhibit_stylesheet_link_tag' do
56
- let(:exhibit) { FactoryBot.create(:exhibit) }
57
-
58
- before do
59
- allow(helper).to receive_messages(current_exhibit: exhibit)
60
- end
61
-
62
- context 'without an exhibit context' do
63
- let(:exhibit) { nil }
64
-
65
- it 'uses the standard stylesheet' do
66
- expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
67
- end
68
- end
69
-
70
- context 'for an exhibit without a selected theme' do
71
- before do
72
- exhibit.update(theme: nil)
73
- end
74
-
75
- it 'uses the standard stylesheet' do
76
- expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
77
- end
78
- end
79
-
80
- context 'for an exhibit with an invalid theme' do
81
- before do
82
- exhibit.update(theme: 'garbage')
83
- end
84
-
85
- it 'uses the standard stylesheet' do
86
- expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
87
- end
88
- end
89
-
90
- context 'for a themed exhibit' do
91
- before do
92
- allow(Spotlight::Engine.config).to receive(:exhibit_themes).and_return(%w[default modern])
93
- exhibit.update(theme: 'modern')
94
- end
95
-
96
- it 'uses a suffixed stylesheet name' do
97
- expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application_modern')
98
- end
99
- end
100
- end
101
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::MastheadHelper, type: :helper do
4
- let(:exhibit) { FactoryBot.create(:exhibit) }
5
- let(:site) { Spotlight::Site.instance }
6
-
7
- before do
8
- allow(helper).to receive(:current_exhibit).and_return(nil)
9
- allow(helper).to receive(:current_site).and_return(site)
10
- end
11
-
12
- describe '#masthead_heading_content' do
13
- context 'when there is a current exhibit' do
14
- before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }
15
-
16
- it { expect(helper.masthead_heading_content).to eq exhibit.title }
17
- end
18
-
19
- context 'when there is no current exhibit' do
20
- it { expect(helper.masthead_heading_content).to eq 'Blacklight' } # the application_name
21
- end
22
- end
23
-
24
- describe '#masthead_subheading_content' do
25
- context 'when there is a current exhibit' do
26
- before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }
27
-
28
- context 'when the exhibit has a subtitle' do
29
- before { exhibit.subtitle = 'MastheadHelper Spec Exhibit' }
30
-
31
- it { expect(helper.masthead_subheading_content).to eq 'MastheadHelper Spec Exhibit' }
32
- end
33
-
34
- context 'when the exhibit does not have a subtitle' do
35
- it { expect(helper.masthead_subheading_content).to be_nil }
36
- end
37
- end
38
-
39
- context 'when there is no current exhibit' do
40
- context 'when the site has a subtitle' do
41
- before { site.subtitle = "The site's subtitle" }
42
-
43
- it { expect(helper.masthead_subheading_content).to eq "The site's subtitle" }
44
- end
45
-
46
- context 'when the site does not have a subtitle' do
47
- it { expect(helper.masthead_subheading_content).to be_nil }
48
- end
49
- end
50
- end
51
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::MetaHelper, type: :helper do
4
- describe '#add_exhibit_meta_content' do
5
- let(:current_exhibit) { FactoryBot.create(:exhibit) }
6
-
7
- before do
8
- allow(helper).to receive_messages(current_exhibit: current_exhibit)
9
- allow(helper).to receive(:site_title).and_return('some title')
10
- current_exhibit.subtitle = 'xyz'
11
- current_exhibit.description = 'abc'
12
- TopHat.current['twitter_card'] = nil
13
- TopHat.current['opengraph'] = nil
14
- end
15
-
16
- it 'generates a twitter card for the exhibit' do
17
- allow(helper).to receive(:exhibit_root_url).and_return('some/url')
18
- allow(current_exhibit).to receive(:thumbnail).and_return(double(iiif_url: 'https://test.host/images/7777/full/400,300/0/default.jpg'))
19
-
20
- helper.add_exhibit_meta_content
21
-
22
- card = helper.twitter_card
23
- expect(card).to have_css "meta[name='twitter:card'][value='summary']", visible: false
24
- expect(card).to have_css "meta[name='twitter:url'][value='some/url']", visible: false
25
- expect(card).to have_css "meta[name='twitter:title'][value='#{current_exhibit.title}']", visible: false
26
- expect(card).to have_css "meta[name='twitter:description'][value='#{current_exhibit.subtitle}']", visible: false
27
- expect(card).to have_css "meta[name='twitter:image'][value='https://test.host/images/7777/full/400,300/0/default.jpg']", visible: false
28
-
29
- graph = helper.opengraph
30
- expect(graph).to have_css "meta[property='og:site_name'][content='some title']", visible: false
31
- end
32
- end
33
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::NavbarHelper, type: :helper do
4
- describe '#should_render_search_bar?' do
5
- before do
6
- allow(helper).to receive_messages(current_exhibit: nil)
7
- allow(helper).to receive_messages(exhibit_masthead?: true)
8
- end
9
-
10
- it 'returns false when there is no exhibit context' do
11
- expect(helper).not_to be_should_render_spotlight_search_bar
12
- end
13
-
14
- it 'returns true if searchable' do
15
- allow(helper).to receive_messages(current_exhibit: double(searchable?: true))
16
- expect(helper).to be_should_render_spotlight_search_bar
17
- end
18
-
19
- it 'returns false if currently under an "Exhibity" browse category' do
20
- allow(helper).to receive_messages(exhibit_masthead?: false)
21
- expect(helper).not_to be_should_render_spotlight_search_bar
22
- end
23
- end
24
- end
@@ -1,123 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::PagesHelper, type: :helper do
4
- let(:blacklight_config) { Blacklight::Configuration.new { |config| config.show.title_field = :abc } }
5
- let(:titled_document) { blacklight_config.document_model.new(abc: 'value') }
6
- let(:untitled_document) { blacklight_config.document_model.new(id: '1234') }
7
- let!(:current_exhibit) { FactoryBot.create(:exhibit) }
8
- let!(:home_page) { current_exhibit.home_page }
9
- let!(:search) { FactoryBot.create(:search, exhibit: current_exhibit, query_params: { 'q' => 'query' }, published: true) }
10
-
11
- before do
12
- allow(helper).to receive_messages(blacklight_config: blacklight_config)
13
- end
14
-
15
- describe 'disable_save_pages_button?' do
16
- it 'returns true if there are no pages and we are on the about pages page' do
17
- expect(helper).to receive(:page_collection_name).and_return('about_pages')
18
- assign(:pages, [])
19
- expect(helper).to be_disable_save_pages_button
20
- end
21
-
22
- it 'returns false if there are about pages' do
23
- expect(helper).to receive(:page_collection_name).and_return('about_pages')
24
- assign(:pages, [{}])
25
- expect(helper).not_to be_disable_save_pages_button
26
- end
27
-
28
- it 'returns false if on the feature pages page' do
29
- expect(helper).to receive(:page_collection_name).and_return('feature_pages')
30
- assign(:pages, [])
31
- expect(helper).not_to be_disable_save_pages_button
32
- end
33
- end
34
-
35
- describe 'get_search_widget_search_results' do
36
- let(:good) do
37
- content = { type: 'xyz', data: { 'item' => { search.slug => { id: search.slug, display: 'true' } } } }
38
- SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
39
- end
40
-
41
- let(:bad) do
42
- content = { type: 'xyz', data: { 'item' => { 'garbage' => { id: 'missing', display: 'true' } } } }
43
- SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
44
- end
45
-
46
- let(:search_result) { [double('response'), double('documents')] }
47
-
48
- it 'returns the results for a given search browse category' do
49
- expect(helper).to receive(:search_results).with({ 'q' => 'query' }).and_return(search_result)
50
- expect(helper.get_search_widget_search_results(good)).to eq search_result
51
- end
52
-
53
- it "returns an empty array when requesting a search that doesn't exist" do
54
- expect(helper.get_search_widget_search_results(bad)).to be_empty
55
- end
56
- end
57
-
58
- describe 'nestable helpers' do
59
- describe 'nestable data attributes' do
60
- it 'returns the appropriate attributes for feature pages' do
61
- expect(helper.nestable_data_attributes('feature_pages')).to eq "data-max-depth='2' data-expand-btn-HTML='' data-collapse-btn-HTML=''"
62
- end
63
-
64
- it 'returns the appropriate attributes for about pages' do
65
- expect(helper.nestable_data_attributes('about_pages')).to eq "data-max-depth='1'"
66
- end
67
-
68
- it 'returns a blank string if the type is not valid' do
69
- expect(helper.nestable_data_attributes('something_else')).to eq ''
70
- end
71
- end
72
-
73
- describe 'nestable data attributes hash' do
74
- it 'returns the appropriate hash for feature pages' do
75
- expect(helper.nestable_data_attributes_hash('feature_pages')).to eq('data-max-depth' => '2',
76
- 'data-expand-btn-HTML' => '',
77
- 'data-collapse-btn-HTML' => '')
78
- end
79
-
80
- it 'returns the appropriate hash for about pages' do
81
- expect(helper.nestable_data_attributes_hash('about_pages')).to eq 'data-max-depth' => '1'
82
- end
83
-
84
- it 'returns an empty hash if the type is not valid' do
85
- expect(helper.nestable_data_attributes_hash('something_else')).to eq({})
86
- end
87
- end
88
- end
89
-
90
- describe '#sir_trevor_markdown' do
91
- it 'handles nil input' do
92
- expect(helper.sir_trevor_markdown(nil)).to be_blank
93
- end
94
-
95
- it 'retains paragraphs' do
96
- expect(helper.sir_trevor_markdown('<p>First Line</p><p>Second Line</p>').chomp).to match(%r{<p>First Line</p>\s*<p>Second Line</p>})
97
- end
98
-
99
- it 'replaces line breaks with paragraphs' do
100
- expect(helper.sir_trevor_markdown('First Line<br>Second Line').chomp).to match(%r{<p>First Line</p>\s*<p>Second Line</p>})
101
- end
102
- end
103
-
104
- describe '#content_editor_class' do
105
- context 'a sir-trevor backed page with a custom class' do
106
- it 'has a custom class' do
107
- expect(helper.content_editor_class(Spotlight::Page.new)).to eq 'js-st-instance'
108
- end
109
- end
110
-
111
- context 'a sir-trevor backed page with a derived class' do
112
- it 'derives a css class name from the editor type' do
113
- expect(helper.content_editor_class(Spotlight::Page.new(content_type: 'Something::Custom'))).to eq 'js-something-custom-instance'
114
- end
115
- end
116
- end
117
-
118
- describe '#render_contact_email_address' do
119
- it 'adds soft breaks in appropriate places' do
120
- expect(helper.render_contact_email_address('local.part@example.com')).to have_css 'wbr', count: 3, visible: false
121
- end
122
- end
123
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::RolesHelper, type: :helper do
4
- it 'is a list of options' do
5
- expect(helper.roles_for_select).to eq('Admin' => 'admin', 'Curator' => 'curator', 'Viewer' => 'viewer')
6
- end
7
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::SearchConfigurationsHelper, type: :helper do
4
- describe '#translate_sort_fields' do
5
- let(:sort_config) do
6
- Blacklight::OpenStructWithHashAccess.new(sort: 'score asc, sort_title_ssi desc')
7
- end
8
-
9
- it 'translates sort fields' do
10
- expect(translate_sort_fields(sort_config)).to eq 'relevancy score ascending and title descending'
11
- end
12
-
13
- it 'humanizes untranslatable sort fields' do
14
- sort_config.sort = 'some_other_field desc'
15
- expect(translate_sort_fields(sort_config)).to eq 'some other field descending'
16
- end
17
-
18
- it 'supports explicit sort descriptions' do
19
- sort_config.sort_description = 'xyz'
20
- expect(translate_sort_fields(sort_config)).to eq 'xyz'
21
- end
22
- end
23
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::TitleHelper, type: :helper do
4
- before do
5
- allow(helper).to receive_messages(application_name: 'Application')
6
- end
7
-
8
- describe '#page_title' do
9
- it 'sets the @page_title ivar' do
10
- helper.page_title('Section', 'Title')
11
- title = helper.instance_variable_get(:@page_title)
12
- expect(title).to eq 'Section - Title | Application'
13
- end
14
-
15
- it 'renders the section title and the page title' do
16
- title = helper.page_title('Section', 'Title')
17
- expect(title).to have_selector 'h1', text: 'Section'
18
- expect(title).to have_selector 'h1 small', text: 'Title'
19
- end
20
-
21
- it 'renders just the section title if that was all that was provided' do
22
- allow(helper).to receive(:t).and_call_original
23
- allow(helper).to receive(:t).with(:'.header', default: '').and_return('')
24
-
25
- title = helper.page_title('Section')
26
-
27
- expect(title).to have_selector 'h1', text: 'Section'
28
- expect(title).not_to have_selector 'h1 small'
29
-
30
- title = helper.instance_variable_get(:@page_title)
31
- expect(title).to eq 'Section | Application'
32
- end
33
- end
34
-
35
- describe '#set_html_page_title' do
36
- it 'assigns the @page_title ivar' do
37
- allow(helper).to receive_messages(application_name: 'B')
38
- helper.set_html_page_title 'A'
39
- title = helper.instance_variable_get(:@page_title)
40
- expect(title).to eq 'A | B'
41
- end
42
-
43
- it 'strips out any HTML tags' do
44
- allow(helper).to receive_messages(application_name: 'B')
45
- expect(helper.set_html_page_title('<b>text</b> should not include HTML')).to eq 'text should not include HTML | B'
46
- end
47
- end
48
-
49
- describe '#curation_page_title' do
50
- it 'renders a page title in the curation section' do
51
- title = helper.curation_page_title 'Some title'
52
- expect(title).to have_selector 'h1', text: 'Curation'
53
- expect(title).to have_selector 'h1 small', text: 'Some title'
54
- end
55
- end
56
-
57
- describe '#configuration_page_title' do
58
- it 'renders a page title in the configuration section' do
59
- title = helper.configuration_page_title 'Some title'
60
- expect(title).to have_selector 'h1', text: 'Configuration'
61
- expect(title).to have_selector 'h1 small', text: 'Some title'
62
- end
63
- end
64
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Spotlight::TranslationsHelper do
4
- describe '#non_custom_metadata_fields' do
5
- let(:exhibit) { FactoryBot.create(:exhibit) }
6
- let!(:custom_field) { FactoryBot.create(:custom_field, exhibit: exhibit) }
7
-
8
- before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }
9
-
10
- it "is an array of the current exhibit's metadata fields with the custom fields removed" do
11
- expect(exhibit.blacklight_config.show_fields.keys).to include custom_field.field
12
-
13
- expect(helper.non_custom_metadata_fields.keys).not_to include custom_field.field
14
- end
15
- end
16
- end
data/spec/i18n_spec.rb DELETED
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'i18n/tasks'
4
-
5
- RSpec.describe 'I18n' do
6
- let(:i18n) { I18n::Tasks::BaseTask.new }
7
- let(:missing_keys) { i18n.missing_keys }
8
- let(:unused_keys) { i18n.unused_keys }
9
-
10
- xit 'does not have missing keys' do
11
- expect(missing_keys).to be_empty,
12
- "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
13
- end
14
-
15
- xit 'does not have unused keys' do
16
- expect(unused_keys).to be_empty,
17
- "#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them"
18
- end
19
-
20
- it 'files are normalized' do
21
- non_normalized = i18n.non_normalized_paths
22
- error_message = "The following files need to be normalized:\n" \
23
- "#{non_normalized.map { |path| " #{path}" }.join("\n")}\n" \
24
- 'Please run `i18n-tasks normalize` to fix'
25
- expect(non_normalized).to be_empty, error_message
26
- end
27
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::AddTagsJob do
4
- subject { described_class.new(solr_params: solr_params, exhibit: exhibit, tags: tags) }
5
-
6
- let(:solr_params) { { q: 'map' } }
7
- let(:exhibit) { FactoryBot.create(:exhibit) }
8
- let(:tags) { 'hello,world' }
9
-
10
- before do
11
- allow(Spotlight::Engine.config).to receive_messages(bulk_actions_batch_size: 5)
12
- end
13
-
14
- it 'adds tags to SolrDocumentSidecar objects' do
15
- subject.perform_now
16
- response = exhibit.blacklight_config.repository.search(solr_params.merge('rows' => 999_999_999))
17
- expect(response.total).to eq 55
18
- expect(Spotlight::JobTracker.last).to have_attributes(
19
- status: 'completed',
20
- total: 55,
21
- progress: 55,
22
- job_class: 'Spotlight::AddTagsJob'
23
- )
24
- response.documents.each do |document|
25
- expect(document.sidecar(exhibit).all_tags_list).to include('hello', 'world')
26
- exhibit.tag(document.sidecar(exhibit), with: [], on: :tags)
27
- end
28
- exhibit.owned_tags.destroy_all
29
- response.documents.each do |document|
30
- document.sidecar(exhibit).destroy
31
- document.reindex
32
- end
33
- end
34
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::AddUploadsFromCsv do
4
- subject(:job) { described_class.new(data, exhibit, user) }
5
-
6
- let(:exhibit) { FactoryBot.create(:exhibit) }
7
- let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
8
- let(:data) do
9
- [
10
- { 'url' => 'x' },
11
- { 'url' => 'y' },
12
- { 'url' => '~' }
13
- ]
14
- end
15
-
16
- let(:resource_x) { instance_double(Spotlight::Resource) }
17
- let(:resource_y) { instance_double(Spotlight::Resource) }
18
-
19
- before do
20
- allow(Spotlight::IndexingCompleteMailer).to receive(:documents_indexed).and_return(double(deliver_now: true))
21
- end
22
-
23
- context 'with empty data' do
24
- let(:data) { [] }
25
-
26
- it 'sends the user an email after the indexing job is complete' do
27
- expect(Spotlight::IndexingCompleteMailer).to receive(:documents_indexed).and_return(double(deliver_now: true))
28
- job.perform_now
29
- end
30
- end
31
-
32
- it 'creates uploaded resources for each row of data' do
33
- upload = FactoryBot.create(:uploaded_resource)
34
- expect(Spotlight::Resources::Upload).to receive(:new).exactly(3).times.and_return(upload)
35
-
36
- expect(upload).to receive(:build_upload).with(remote_image_url: 'x').and_call_original
37
- expect(upload).to receive(:build_upload).with(remote_image_url: 'y').and_call_original
38
- expect(upload).not_to receive(:build_upload).with(remote_image_url: '~')
39
- expect(upload).to receive(:save_and_index).at_least(:once)
40
-
41
- job.perform_now
42
- end
43
-
44
- context 'with errors' do
45
- it 'collects errors uploaded resources for each row of data' do
46
- allow(Spotlight::IndexingCompleteMailer).to receive(:documents_indexed).and_return(double(deliver_now: true))
47
- job.perform_now
48
- expect(Spotlight::IndexingCompleteMailer).to have_received(:documents_indexed).with(
49
- data, exhibit, user,
50
- indexed_count: 1,
51
- errors: {
52
- 1 => array_including(match(Regexp.union(/relative URI: x/, /URI scheme '' not in whitelist:/))),
53
- 2 => array_including(match(/Upload is invalid/))
54
- }
55
- )
56
- end
57
- end
58
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::ChangeVisibilityJob do
4
- subject { described_class.new(solr_params: solr_params, exhibit: exhibit, visibility: visibility) }
5
-
6
- let(:solr_params) { { q: 'map' } }
7
- let(:exhibit) { FactoryBot.create(:exhibit) }
8
- let(:visibility) { 'private' }
9
-
10
- before do
11
- allow(Spotlight::Engine.config).to receive_messages(bulk_actions_batch_size: 5)
12
- end
13
-
14
- it 'sets the items based off of the visibility' do
15
- subject.perform_now
16
- response = exhibit.blacklight_config.repository.search(solr_params.merge('rows' => 999_999_999))
17
- expect(response.total).to eq 55
18
- expect(Spotlight::JobTracker.last).to have_attributes(
19
- status: 'completed',
20
- total: 55,
21
- progress: 55,
22
- job_class: 'Spotlight::ChangeVisibilityJob'
23
- )
24
- response.documents.each do |document|
25
- expect(document.private?(exhibit)).to be true
26
- document.make_public!(exhibit)
27
- document.reindex
28
- end
29
- end
30
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe Spotlight::DefaultThumbnailJob do
4
- subject { described_class.new(thumbnailable) }
5
-
6
- let(:thumbnailable) { double('Thumbnailable') }
7
-
8
- it 'calls #set_default_thumbnail on the object passed in and saves' do
9
- expect(thumbnailable).to receive(:set_default_thumbnail)
10
- expect(thumbnailable).to receive(:save)
11
-
12
- subject.perform_now
13
- end
14
- end