blacklight 8.2.2 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +60 -62
  4. data/.rubocop.yml +229 -21
  5. data/.rubocop_todo.yml +22 -55
  6. data/Gemfile +2 -10
  7. data/README.md +2 -2
  8. data/VERSION +1 -1
  9. data/app/assets/javascripts/blacklight/blacklight.esm.js +5 -1
  10. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  11. data/app/assets/javascripts/blacklight/blacklight.js +5 -1
  12. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  13. data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -1
  14. data/app/assets/stylesheets/blacklight/_bookmark.scss +30 -0
  15. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -4
  16. data/app/assets/stylesheets/blacklight/_constraints.scss +15 -9
  17. data/app/assets/stylesheets/blacklight/_controls.scss +0 -1
  18. data/app/assets/stylesheets/blacklight/_facets.scss +33 -37
  19. data/app/assets/stylesheets/blacklight/_header.scss +2 -35
  20. data/app/assets/stylesheets/blacklight/_icons.scss +3 -2
  21. data/app/assets/stylesheets/blacklight/_layout.scss +3 -0
  22. data/app/assets/stylesheets/blacklight/_mixins.scss +6 -21
  23. data/app/assets/stylesheets/blacklight/_search_form.scss +3 -8
  24. data/app/assets/stylesheets/blacklight/_search_history.scss +5 -5
  25. data/app/assets/stylesheets/blacklight/_search_results.scss +5 -2
  26. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +16 -10
  27. data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
  28. data/app/components/blacklight/advanced_search_form_component.rb +6 -0
  29. data/app/components/blacklight/constraint_layout_component.html.erb +2 -9
  30. data/app/components/blacklight/constraint_layout_component.rb +8 -0
  31. data/app/components/blacklight/constraints_component.rb +3 -3
  32. data/app/components/blacklight/document/action_component.rb +2 -1
  33. data/app/components/blacklight/document/bookmark_component.html.erb +2 -1
  34. data/app/components/blacklight/document/bookmark_component.rb +6 -0
  35. data/app/components/blacklight/document/page_header_component.html.erb +7 -0
  36. data/app/components/blacklight/document/page_header_component.rb +85 -0
  37. data/app/components/blacklight/document_component.rb +1 -1
  38. data/app/components/blacklight/facet_component.rb +1 -1
  39. data/app/components/blacklight/facet_field_checkboxes_component.html.erb +1 -1
  40. data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
  41. data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +1 -1
  42. data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
  43. data/app/components/blacklight/facet_item_component.rb +1 -1
  44. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  45. data/app/components/blacklight/icons/bookmark_icon_component.rb +17 -0
  46. data/app/components/blacklight/icons/icon_component.rb +9 -4
  47. data/app/components/blacklight/icons/remove_component.rb +16 -0
  48. data/app/components/blacklight/metadata_field_component.html.erb +1 -1
  49. data/app/components/blacklight/metadata_field_component.rb +5 -0
  50. data/app/components/blacklight/response/facet_group_component.rb +1 -1
  51. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  52. data/app/components/blacklight/response/sort_component.html.erb +1 -6
  53. data/app/components/blacklight/response/sort_component.rb +15 -0
  54. data/app/components/blacklight/search/per_page_component.html.erb +2 -0
  55. data/app/components/blacklight/search/per_page_component.rb +50 -0
  56. data/app/components/blacklight/search_bar_component.html.erb +1 -1
  57. data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +4 -7
  58. data/app/components/blacklight/skip_link_component.html.erb +7 -0
  59. data/app/components/blacklight/skip_link_component.rb +17 -0
  60. data/app/components/blacklight/system/dropdown_button_component.rb +18 -0
  61. data/app/components/blacklight/system/dropdown_component.rb +4 -7
  62. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  63. data/app/components/blacklight/top_navbar_component.html.erb +2 -2
  64. data/app/components/blacklight/top_navbar_component.rb +4 -0
  65. data/app/helpers/blacklight/catalog_helper_behavior.rb +3 -5
  66. data/app/helpers/blacklight/component_helper_behavior.rb +4 -4
  67. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -0
  68. data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
  69. data/app/javascript/blacklight/checkbox_submit.js +5 -1
  70. data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
  71. data/app/presenters/blacklight/facet_checkbox_item_presenter.rb +11 -0
  72. data/app/presenters/blacklight/facet_field_presenter.rb +9 -1
  73. data/app/services/blacklight/search_service.rb +9 -1
  74. data/app/views/catalog/_per_page_widget.html.erb +1 -10
  75. data/app/views/catalog/_search_results.html.erb +1 -1
  76. data/app/views/catalog/_show_main_content.html.erb +1 -1
  77. data/app/views/catalog/show.html.erb +0 -2
  78. data/app/views/catalog/suggest.html.erb +1 -1
  79. data/app/views/kaminari/blacklight/_page.html.erb +14 -8
  80. data/app/views/layouts/blacklight/base.html.erb +3 -4
  81. data/app/views/shared/_flash_messages.html.erb +1 -1
  82. data/blacklight.gemspec +4 -0
  83. data/{docker-compose.yml → compose.yaml} +1 -1
  84. data/config/locales/blacklight.ar.yml +3 -0
  85. data/config/locales/blacklight.de.yml +3 -0
  86. data/config/locales/blacklight.en.yml +216 -229
  87. data/config/locales/blacklight.es.yml +3 -0
  88. data/config/locales/blacklight.fr.yml +3 -0
  89. data/config/locales/blacklight.hu.yml +3 -0
  90. data/config/locales/blacklight.it.yml +3 -0
  91. data/config/locales/blacklight.nl.yml +3 -0
  92. data/config/locales/blacklight.pt-BR.yml +3 -0
  93. data/config/locales/blacklight.sq.yml +3 -0
  94. data/config/locales/blacklight.zh.yml +3 -0
  95. data/lib/blacklight/abstract_repository.rb +6 -0
  96. data/lib/blacklight/configuration.rb +33 -19
  97. data/lib/blacklight/nested_open_struct_with_hash_access.rb +2 -2
  98. data/lib/blacklight/parameters.rb +1 -1
  99. data/lib/blacklight/solr/repository.rb +11 -4
  100. data/lib/blacklight/solr/request.rb +1 -1
  101. data/lib/blacklight/solr/response/facets.rb +1 -1
  102. data/lib/blacklight/solr/response/params.rb +1 -1
  103. data/lib/blacklight/solr/response.rb +0 -12
  104. data/lib/blacklight/solr/search_builder_behavior.rb +2 -2
  105. data/lib/blacklight/solr.rb +0 -6
  106. data/lib/blacklight.rb +4 -14
  107. data/lib/generators/blacklight/assets/propshaft_generator.rb +2 -2
  108. data/lib/generators/blacklight/models_generator.rb +1 -1
  109. data/package.json +1 -1
  110. data/spec/components/blacklight/advanced_search_form_component_spec.rb +2 -2
  111. data/spec/components/blacklight/constraint_layout_component_spec.rb +11 -11
  112. data/spec/components/blacklight/constraints_component_spec.rb +9 -9
  113. data/spec/components/blacklight/document/action_component_spec.rb +1 -1
  114. data/spec/components/blacklight/document/group_component_spec.rb +3 -3
  115. data/spec/components/blacklight/document/page_header_component_spec.rb +92 -0
  116. data/spec/components/blacklight/document/sidebar_component_spec.rb +3 -4
  117. data/spec/components/blacklight/document_component_spec.rb +41 -25
  118. data/spec/components/blacklight/facet_component_spec.rb +2 -2
  119. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +5 -5
  120. data/spec/components/blacklight/facet_field_list_component_spec.rb +13 -13
  121. data/spec/components/blacklight/facet_item_component_spec.rb +5 -5
  122. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +6 -6
  123. data/spec/components/blacklight/header_component_spec.rb +1 -2
  124. data/spec/components/blacklight/hidden_search_state_component_spec.rb +6 -6
  125. data/spec/components/blacklight/icons/icon_component_spec.rb +42 -0
  126. data/spec/components/blacklight/metadata_field_component_spec.rb +3 -3
  127. data/spec/components/blacklight/response/pagination_component_spec.rb +4 -4
  128. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +1 -1
  129. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +2 -4
  130. data/spec/components/blacklight/system/flash_message_component_spec.rb +5 -5
  131. data/spec/controllers/blacklight/catalog_spec.rb +2 -2
  132. data/spec/controllers/blacklight/{catalog/component_configuration_spec.rb → configurable_spec.rb} +1 -1
  133. data/spec/controllers/bookmarks_controller_spec.rb +10 -10
  134. data/spec/controllers/catalog_controller_spec.rb +29 -31
  135. data/spec/features/advanced_search_spec.rb +30 -16
  136. data/spec/features/alternate_controller_spec.rb +9 -9
  137. data/spec/features/axe_spec.rb +4 -4
  138. data/spec/features/bookmarks_spec.rb +34 -19
  139. data/spec/features/citation_spec.rb +1 -1
  140. data/spec/features/did_you_mean_spec.rb +23 -23
  141. data/spec/features/facet_missing_spec.rb +9 -9
  142. data/spec/features/facets_spec.rb +21 -20
  143. data/spec/features/modal_spec.rb +4 -4
  144. data/spec/features/record_view_spec.rb +2 -2
  145. data/spec/features/search_context_spec.rb +6 -6
  146. data/spec/features/search_crawler_spec.rb +5 -5
  147. data/spec/features/search_filters_spec.rb +65 -65
  148. data/spec/features/search_history_spec.rb +12 -12
  149. data/spec/features/search_pagination_spec.rb +10 -10
  150. data/spec/features/search_results_spec.rb +1 -1
  151. data/spec/features/search_sort_spec.rb +4 -4
  152. data/spec/features/search_spec.rb +25 -25
  153. data/spec/features/sitelinks_search_box_spec.rb +2 -2
  154. data/spec/features/sms_spec.rb +1 -1
  155. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +2 -2
  156. data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
  157. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +2 -1
  158. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +7 -8
  159. data/spec/helpers/blacklight_helper_spec.rb +13 -15
  160. data/spec/helpers/catalog_helper_spec.rb +3 -6
  161. data/spec/i18n_spec.rb +2 -1
  162. data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +1 -1
  163. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +1 -1
  164. data/spec/lib/blacklight/search_state_spec.rb +4 -4
  165. data/spec/lib/tasks/blacklight_task_spec.rb +2 -1
  166. data/spec/models/blacklight/configurable_spec.rb +1 -1
  167. data/spec/models/blacklight/configuration/context_spec.rb +1 -1
  168. data/spec/models/blacklight/configuration_spec.rb +14 -14
  169. data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -1
  170. data/spec/models/blacklight/document/cache_key_spec.rb +1 -1
  171. data/spec/models/blacklight/document_spec.rb +1 -1
  172. data/spec/models/blacklight/facet_paginator_spec.rb +14 -14
  173. data/spec/models/blacklight/icon_spec.rb +1 -1
  174. data/spec/models/blacklight/search_builder_spec.rb +1 -1
  175. data/spec/models/blacklight/solr/document_spec.rb +3 -3
  176. data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -1
  177. data/spec/models/blacklight/solr/repository_spec.rb +33 -15
  178. data/spec/models/blacklight/solr/request_spec.rb +1 -1
  179. data/spec/models/blacklight/solr/response/facets_spec.rb +3 -3
  180. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
  181. data/spec/models/blacklight/solr/response/group_spec.rb +2 -2
  182. data/spec/models/blacklight/solr/response_spec.rb +3 -3
  183. data/spec/models/blacklight/solr/{search_builder_spec.rb → search_builder_behavior_spec.rb} +10 -20
  184. data/spec/models/blacklight/suggest/response_spec.rb +1 -1
  185. data/spec/models/blacklight/suggest_search_spec.rb +1 -1
  186. data/spec/models/blacklight/user_spec.rb +1 -1
  187. data/spec/models/bookmark_spec.rb +1 -1
  188. data/spec/models/solr_document_spec.rb +1 -1
  189. data/spec/presenters/blacklight/document_presenter_spec.rb +3 -4
  190. data/spec/presenters/blacklight/facet_checkbox_item_presenter_spec.rb +42 -0
  191. data/spec/presenters/blacklight/facet_field_presenter_spec.rb +14 -0
  192. data/spec/presenters/blacklight/field_presenter_spec.rb +1 -1
  193. data/spec/presenters/blacklight/index_presenter_spec.rb +2 -3
  194. data/spec/presenters/blacklight/json_presenter_spec.rb +1 -1
  195. data/spec/presenters/{pipeline_spec.rb → blacklight/rendering/pipeline_spec.rb} +1 -1
  196. data/spec/presenters/blacklight/show_presenter_spec.rb +5 -6
  197. data/spec/presenters/{thumbnail_presenter_spec.rb → blacklight/thumbnail_presenter_spec.rb} +5 -3
  198. data/spec/requests/load_suggestions_spec.rb +5 -5
  199. data/spec/routing/catalog_routing_spec.rb +1 -1
  200. data/spec/services/blacklight/field_retriever_spec.rb +1 -1
  201. data/spec/services/blacklight/search_service_spec.rb +11 -11
  202. data/spec/spec_helper.rb +2 -2
  203. data/spec/support/features/search_helpers.rb +2 -2
  204. data/spec/support/features/session_helpers.rb +3 -3
  205. data/spec/test_app_templates/lib/generators/test_app_generator.rb +3 -3
  206. data/spec/views/catalog/_document.html.erb_spec.rb +1 -4
  207. data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -2
  208. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -6
  209. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +7 -7
  210. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +4 -4
  211. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -4
  212. data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -2
  213. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -7
  214. data/spec/views/catalog/email_success.html.erb_spec.rb +1 -1
  215. data/spec/views/catalog/facet.html.erb_spec.rb +1 -1
  216. data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
  217. data/spec/views/catalog/index.atom.builder_spec.rb +18 -19
  218. data/spec/views/catalog/index.html.erb_spec.rb +2 -4
  219. data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -8
  220. data/spec/views/catalog/show.html.erb_spec.rb +3 -5
  221. data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -2
  222. data/spec/views/catalog/sms_success.html.erb_spec.rb +1 -1
  223. data/spec/views/shared/_user_util_links.html.erb_spec.rb +2 -3
  224. data/tasks/blacklight.rake +5 -5
  225. metadata +84 -12
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
3
+ RSpec.describe 'catalog/_facet_index_navigation.html.erb' do
4
4
  let(:pagination) { Blacklight::Solr::FacetPaginator.new([]) }
5
5
  let(:facet) { Blacklight::Configuration::FacetField.new(index_range: '0'..'9', presenter: Blacklight::FacetFieldPresenter) }
6
6
  let(:display_facet) { double(items: [], offset: 0, prefix: '', sort: 'index') }
@@ -9,14 +9,13 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
9
9
  before do
10
10
  assign(:display_facet, display_facet)
11
11
  assign(:facet, facet)
12
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
13
- allow(view).to receive(:facet_limit_for).and_return(10)
12
+ allow(view).to receive_messages(blacklight_config: blacklight_config, facet_limit_for: 10)
14
13
  controller.request.path_parameters[:action] = 'index'
15
14
  end
16
15
 
17
16
  it 'renders the facet index navigation range' do
18
17
  render
19
- expect(rendered).to have_selector '.pagination'
18
+ expect(rendered).to have_css '.pagination'
20
19
  expect(rendered).to have_link '0', href: '/?facet.prefix=0&facet.sort=index'
21
20
  expect(rendered).to have_link '1'
22
21
  expect(rendered).to have_link '8'
@@ -25,7 +24,7 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
25
24
 
26
25
  it 'renders an "all" button' do
27
26
  render
28
- expect(rendered).to have_selector '.page-link', text: 'All'
27
+ expect(rendered).to have_css '.page-link', text: 'All'
29
28
  end
30
29
 
31
30
  context 'with a selected index' do
@@ -33,7 +32,7 @@ RSpec.describe 'catalog/_facet_index_navigation.html.erb', type: :view do
33
32
 
34
33
  it 'highlights the selected index' do
35
34
  render
36
- expect(rendered).to have_selector '.active', text: '5'
35
+ expect(rendered).to have_css '.active', text: '5'
37
36
  end
38
37
 
39
38
  it 'enables the clear facets button' do
@@ -17,25 +17,25 @@ RSpec.describe "catalog/facet_layout" do
17
17
 
18
18
  it "has a facet-specific class" do
19
19
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
20
- expect(rendered).to have_selector '.blacklight-some_field'
20
+ expect(rendered).to have_css '.blacklight-some_field'
21
21
  end
22
22
 
23
23
  it "has a title with a link for a11y" do
24
24
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
25
- expect(rendered).to have_selector 'h3', text: 'Some Field'
25
+ expect(rendered).to have_css 'h3', text: 'Some Field'
26
26
  end
27
27
 
28
28
  it "is collapsable" do
29
29
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
30
- expect(rendered).to have_selector 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
31
- expect(rendered).to have_selector '.collapse .card-body'
30
+ expect(rendered).to have_css 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
31
+ expect(rendered).to have_css '.collapse .card-body'
32
32
  end
33
33
 
34
34
  it "is configured to be open by default" do
35
35
  allow(facet_field).to receive_messages(collapse: false)
36
36
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
37
- expect(rendered).to have_selector 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
38
- expect(rendered).not_to have_selector '.card-header.collapsed'
39
- expect(rendered).to have_selector '.collapse.show .card-body'
37
+ expect(rendered).to have_css 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
38
+ expect(rendered).to have_no_css '.card-header.collapsed'
39
+ expect(rendered).to have_css '.collapse.show .card-body'
40
40
  end
41
41
  end
@@ -11,14 +11,14 @@ RSpec.describe "catalog/_paginate_compact.html.erb" do
11
11
 
12
12
  it "renders paginatable arrays" do
13
13
  render partial: 'catalog/paginate_compact', object: Kaminari.paginate_array([], total_count: 145).page(1).per(10)
14
- expect(rendered).to have_selector ".page-entries"
15
- expect(rendered).to have_selector "a[@rel=next]"
14
+ expect(rendered).to have_css ".page-entries"
15
+ expect(rendered).to have_css "a[@rel=next]"
16
16
  end
17
17
 
18
18
  it "renders ActiveRecord collections" do
19
19
  50.times { b = Bookmark.new; b.user = user; b.save! }
20
20
  render partial: 'catalog/paginate_compact', object: Bookmark.page(1).per(25)
21
- expect(rendered).to have_selector ".page-entries"
22
- expect(rendered).to have_selector "a[@rel=next]"
21
+ expect(rendered).to have_css ".page-entries"
22
+ expect(rendered).to have_css "a[@rel=next]"
23
23
  end
24
24
  end
@@ -11,10 +11,7 @@ RSpec.describe "catalog/_show_sidebar.html.erb" do
11
11
  end
12
12
 
13
13
  before do
14
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
15
- allow(view).to receive(:has_user_authentication_provider?).and_return(false)
16
- allow(view).to receive(:document_actions).and_return([])
17
- allow(view).to receive(:session_tracking_params).and_return({})
14
+ allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false, document_actions: [], session_tracking_params: {})
18
15
  end
19
16
 
20
17
  it "shows more-like-this titles in the sidebar" do
@@ -9,8 +9,7 @@ RSpec.describe "catalog/_show_tools.html.erb" do
9
9
  allow(Blacklight::Document::ShowToolsComponent).to receive(:new).and_return(component)
10
10
  allow(view).to receive(:render).with(component)
11
11
  allow(view).to receive(:render).with('catalog/show_tools', { document: document }).and_call_original
12
- allow(view).to receive(:blacklight_config).and_return blacklight_config
13
- allow(view).to receive(:has_user_authentication_provider?).and_return false
12
+ allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false)
14
13
  end
15
14
 
16
15
  describe "document actions" do
@@ -34,13 +34,13 @@ RSpec.describe "catalog/_view_type_group" do
34
34
  config.view.c(icon: :list)
35
35
  end
36
36
  render partial: 'catalog/view_type_group'
37
- expect(rendered).to have_selector('.btn-group.view-type-group')
38
- expect(rendered).to have_selector('.view-type-a', text: 'A')
37
+ expect(rendered).to have_css('.btn-group.view-type-group')
38
+ expect(rendered).to have_css('.view-type-a', text: 'A')
39
39
  within '.view-type-a' do
40
- expect(rendered).to have_selector 'svg'
40
+ expect(rendered).to have_css 'svg'
41
41
  end
42
- expect(rendered).to have_selector('.view-type-b', text: 'B')
43
- expect(rendered).to have_selector('.view-type-c', text: 'C')
42
+ expect(rendered).to have_css('.view-type-b', text: 'B')
43
+ expect(rendered).to have_css('.view-type-c', text: 'C')
44
44
  end
45
45
 
46
46
  it "sets the current view to 'active'" do
@@ -50,7 +50,7 @@ RSpec.describe "catalog/_view_type_group" do
50
50
  config.view.b(icon: :list)
51
51
  end
52
52
  render partial: 'catalog/view_type_group'
53
- expect(rendered).to have_selector('.active', text: 'A')
54
- expect(rendered).not_to have_selector('.active', text: 'B')
53
+ expect(rendered).to have_css('.active', text: 'A')
54
+ expect(rendered).to have_no_css('.active', text: 'B')
55
55
  end
56
56
  end
@@ -3,6 +3,6 @@
3
3
  RSpec.describe "catalog/email_success.html.erb" do
4
4
  it "includes updates to the main flash messages" do
5
5
  render
6
- expect(rendered).to have_selector 'turbo-stream[action="append"][target="main-flashes"]'
6
+ expect(rendered).to have_css 'turbo-stream[action="append"][target="main-flashes"]'
7
7
  end
8
8
  end
@@ -19,7 +19,7 @@ RSpec.describe 'catalog/facet.html.erb' do
19
19
 
20
20
  it "has the facet title" do
21
21
  render
22
- expect(rendered).to have_selector 'h1', text: "Facet title"
22
+ expect(rendered).to have_css 'h1', text: "Facet title"
23
23
  end
24
24
 
25
25
  it "renders facet pagination" do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe "catalog/facet.json", api: true do
3
+ RSpec.describe "catalog/facet.json", :api do
4
4
  it "renders facet json" do
5
5
  assign :pagination, items: [{ value: 'Book' }]
6
6
  render template: "catalog/facet", formats: [:json]
@@ -20,8 +20,7 @@ RSpec.describe "catalog/index" do
20
20
  allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
21
21
  allow(@response).to receive(:documents).and_return(document_list)
22
22
  params['content_format'] = 'some_format'
23
- allow(view).to receive(:action_name).and_return('index')
24
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
23
+ allow(view).to receive_messages(action_name: 'index', blacklight_config: blacklight_config)
25
24
  end
26
25
 
27
26
  # We need to use rexml to test certain things that have_tag wont' test
@@ -30,13 +29,13 @@ RSpec.describe "catalog/index" do
30
29
  it "has contextual information" do
31
30
  render template: 'catalog/index', formats: [:atom]
32
31
 
33
- expect(rendered).to have_selector("link[rel=self]")
34
- expect(rendered).to have_selector("link[rel=next]")
35
- expect(rendered).to have_selector("link[rel=previous]")
36
- expect(rendered).to have_selector("link[rel=first]")
37
- expect(rendered).to have_selector("link[rel=last]")
38
- expect(rendered).to have_selector("link[rel='alternate'][type='text/html']")
39
- expect(rendered).to have_selector("link[rel=search][type='application/opensearchdescription+xml']")
32
+ expect(rendered).to have_css("link[rel=self]")
33
+ expect(rendered).to have_css("link[rel=next]")
34
+ expect(rendered).to have_css("link[rel=previous]")
35
+ expect(rendered).to have_css("link[rel=first]")
36
+ expect(rendered).to have_css("link[rel=last]")
37
+ expect(rendered).to have_css("link[rel='alternate'][type='text/html']")
38
+ expect(rendered).to have_css("link[rel=search][type='application/opensearchdescription+xml']")
40
39
  end
41
40
 
42
41
  it "gets paging data correctly from response" do
@@ -62,33 +61,33 @@ RSpec.describe "catalog/index" do
62
61
  it "has ten entries" do
63
62
  render template: 'catalog/index', formats: [:atom]
64
63
 
65
- expect(rendered).to have_selector("entry", count: 10)
64
+ expect(rendered).to have_css("entry", count: 10)
66
65
  end
67
66
 
68
67
  describe "entries" do
69
68
  it "has a title" do
70
69
  render template: 'catalog/index', formats: [:atom]
71
- expect(rendered).to have_selector("entry > title")
70
+ expect(rendered).to have_css("entry > title")
72
71
  end
73
72
 
74
73
  it "has an updated" do
75
74
  render template: 'catalog/index', formats: [:atom]
76
- expect(rendered).to have_selector("entry > updated")
75
+ expect(rendered).to have_css("entry > updated")
77
76
  end
78
77
 
79
78
  it "has html link" do
80
79
  render template: 'catalog/index', formats: [:atom]
81
- expect(rendered).to have_selector("entry > link[rel=alternate][type='text/html']")
80
+ expect(rendered).to have_css("entry > link[rel=alternate][type='text/html']")
82
81
  end
83
82
 
84
83
  it "has an id" do
85
84
  render template: 'catalog/index', formats: [:atom]
86
- expect(rendered).to have_selector("entry > id")
85
+ expect(rendered).to have_css("entry > id")
87
86
  end
88
87
 
89
88
  it "has a summary" do
90
89
  render template: 'catalog/index', formats: [:atom]
91
- expect(rendered).to have_selector("entry > summary", text: 'Title 0')
90
+ expect(rendered).to have_css("entry > summary", text: 'Title 0')
92
91
  end
93
92
 
94
93
  context 'with a custom template' do
@@ -107,7 +106,7 @@ RSpec.describe "catalog/index" do
107
106
 
108
107
  it "has the customized summary" do
109
108
  render template: 'catalog/index', formats: [:atom]
110
- expect(rendered).to have_selector("entry > summary", text: 'whatever content')
109
+ expect(rendered).to have_css("entry > summary", text: 'whatever content')
111
110
  end
112
111
  end
113
112
 
@@ -136,12 +135,12 @@ RSpec.describe "catalog/index" do
136
135
 
137
136
  it "includes a link rel tag" do
138
137
  render template: 'catalog/index', formats: [:atom]
139
- expect(entry).to have_selector("link[rel=alternate][type='application/some-format']")
138
+ expect(entry).to have_css("link[rel=alternate][type='application/some-format']")
140
139
  end
141
140
 
142
141
  it "has content embedded" do
143
142
  render template: 'catalog/index', formats: [:atom]
144
- expect(entry).to have_selector("content")
143
+ expect(entry).to have_css("content")
145
144
  end
146
145
  end
147
146
 
@@ -150,7 +149,7 @@ RSpec.describe "catalog/index" do
150
149
 
151
150
  it "does not have content embedded" do
152
151
  render template: 'catalog/index', formats: [:atom]
153
- expect(entry).not_to have_selector("content[type='application/some-format']")
152
+ expect(entry).to have_no_css("content[type='application/some-format']")
154
153
  end
155
154
  end
156
155
  end
@@ -3,8 +3,7 @@
3
3
  RSpec.describe "catalog/index.html.erb" do
4
4
  describe "with no search parameters" do
5
5
  before do
6
- allow(view).to receive(:has_search_parameters?).and_return(false)
7
- allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
6
+ allow(view).to receive_messages(has_search_parameters?: false, blacklight_config: CatalogController.blacklight_config)
8
7
  @response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10, aggregations: {})
9
8
  end
10
9
 
@@ -19,10 +18,9 @@ RSpec.describe "catalog/index.html.erb" do
19
18
 
20
19
  describe "with search parameters" do
21
20
  before do
22
- allow(view).to receive(:has_search_parameters?).and_return(true)
23
21
  stub_template "catalog/_results_pagination.html.erb" => ""
24
22
  stub_template "catalog/_search_header.html.erb" => "header_content"
25
- allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
23
+ allow(view).to receive_messages(has_search_parameters?: true, blacklight_config: Blacklight::Configuration.new)
26
24
  @response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10)
27
25
  end
28
26
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe "catalog/index.json", api: true do
3
+ RSpec.describe "catalog/index.json", :api do
4
4
  let(:response) { instance_double(Blacklight::Solr::Response, documents: docs, prev_page: nil, next_page: 2, total_pages: 3) }
5
5
  let(:docs) do
6
6
  [
@@ -32,13 +32,10 @@ RSpec.describe "catalog/index.json", api: true do
32
32
  end
33
33
 
34
34
  before do
35
- allow(view).to receive(:blacklight_config).and_return(config)
36
- allow(view).to receive(:search_action_path).and_return('http://test.host/some/search/url')
37
- allow(view).to receive(:search_facet_path).and_return('http://test.host/some/facet/url')
38
- allow(presenter).to receive(:pagination_info).and_return(current_page: 1,
39
- next_page: 2,
40
- prev_page: nil)
41
- allow(presenter).to receive(:search_facets).and_return([format_facet])
35
+ allow(view).to receive_messages(blacklight_config: config, search_action_path: 'http://test.host/some/search/url', search_facet_path: 'http://test.host/some/facet/url')
36
+ allow(presenter).to receive_messages(pagination_info: { current_page: 1,
37
+ next_page: 2,
38
+ prev_page: nil }, search_facets: [format_facet])
42
39
  assign :presenter, presenter
43
40
  assign :response, response
44
41
  end
@@ -7,13 +7,11 @@ RSpec.describe "catalog/show.html.erb" do
7
7
 
8
8
  before do
9
9
  allow(presenter).to receive(:html_title).and_return('Heading')
10
- allow(view).to receive(:document_presenter).and_return(presenter)
11
- allow(view).to receive(:action_name).and_return('show')
12
10
  allow(view).to receive_messages(has_user_authentication_provider?: false)
13
11
  allow(view).to receive_messages(render_document_sidebar_partial: "Sidebar")
14
12
  allow(view).to receive_messages(current_search_session: nil, search_session: {})
15
13
  assign :document, document
16
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
14
+ allow(view).to receive_messages(document_presenter: presenter, action_name: 'show', blacklight_config: blacklight_config)
17
15
  end
18
16
 
19
17
  it "sets the @page_title" do
@@ -26,8 +24,8 @@ RSpec.describe "catalog/show.html.erb" do
26
24
  it "includes schema.org itemscope/type properties" do
27
25
  allow(document).to receive_messages(itemtype: 'some-item-type-uri')
28
26
  render
29
- expect(rendered).to have_selector('div#document[@itemscope]')
30
- expect(rendered).to have_selector('div#document[@itemtype="some-item-type-uri"]')
27
+ expect(rendered).to have_css('div#document[@itemscope]')
28
+ expect(rendered).to have_css('div#document[@itemtype="some-item-type-uri"]')
31
29
  end
32
30
 
33
31
  it "uses the show.partials parameter to determine the partials to render" do
@@ -16,8 +16,7 @@ RSpec.describe "catalog/show.json" do
16
16
  end
17
17
 
18
18
  before do
19
- allow(view).to receive(:blacklight_config).and_return(config)
20
- allow(view).to receive(:action_name).and_return('show')
19
+ allow(view).to receive_messages(blacklight_config: config, action_name: 'show')
21
20
  assign :document, document
22
21
  end
23
22
 
@@ -3,6 +3,6 @@
3
3
  RSpec.describe "catalog/sms_success.html.erb" do
4
4
  it "includes updates to the main flash messages" do
5
5
  render
6
- expect(rendered).to have_selector 'turbo-stream[action="append"][target="main-flashes"]'
6
+ expect(rendered).to have_css 'turbo-stream[action="append"][target="main-flashes"]'
7
7
  end
8
8
  end
@@ -9,11 +9,10 @@ RSpec.describe "shared/_user_util_links" do
9
9
 
10
10
  it "renders the correct bookmark count" do
11
11
  count = rand(99)
12
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
13
12
  allow(controller).to receive(:render_bookmarks_control?).and_return true
14
- allow(view).to receive(:has_user_authentication_provider?).and_return false
13
+ allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false)
15
14
  allow(view).to receive_message_chain(:current_or_guest_user, :bookmarks, :count).and_return(count)
16
15
  render "shared/user_util_links"
17
- expect(rendered).to have_selector('#bookmarks_nav span.badge[data-role=bookmark-counter]', text: count.to_s)
16
+ expect(rendered).to have_css('#bookmarks_nav span.badge[data-role=bookmark-counter]', text: count.to_s)
18
17
  end
19
18
  end
@@ -21,18 +21,18 @@ def system_with_error_handling(*args)
21
21
  end
22
22
 
23
23
  def with_solr(&block)
24
- # We're being invoked by the app entrypoint script and solr is already up via docker-compose
24
+ # We're being invoked by the app entrypoint script and solr is already up via docker compose
25
25
  if ENV['SOLR_ENV'] == 'docker-compose'
26
26
  yield
27
- elsif system('docker-compose -v')
28
- # We're not running docker-compose up but still want to use a docker instance of solr.
27
+ elsif system('docker compose -v')
28
+ # We're not running `docker compose up' but still want to use a docker instance of solr.
29
29
  begin
30
30
  puts "Starting Solr"
31
- system_with_error_handling "docker-compose up -d solr"
31
+ system_with_error_handling "docker compose up -d solr"
32
32
  yield
33
33
  ensure
34
34
  puts "Stopping Solr"
35
- system_with_error_handling "docker-compose stop solr"
35
+ system_with_error_handling "docker compose stop solr"
36
36
  end
37
37
  else
38
38
  SolrWrapper.wrap do |solr|