blacklight 8.2.2 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +56 -62
  4. data/.rubocop.yml +226 -21
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/_mixins.scss +2 -17
  7. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  8. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  9. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -5
  10. data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
  11. data/app/views/shared/_flash_messages.html.erb +1 -1
  12. data/lib/blacklight/configuration.rb +1 -0
  13. data/lib/blacklight/nested_open_struct_with_hash_access.rb +2 -2
  14. data/lib/blacklight/solr/request.rb +1 -1
  15. data/lib/blacklight/solr/response/facets.rb +1 -1
  16. data/lib/blacklight/solr/search_builder_behavior.rb +1 -1
  17. data/package.json +1 -1
  18. data/spec/components/blacklight/advanced_search_form_component_spec.rb +2 -2
  19. data/spec/components/blacklight/constraint_layout_component_spec.rb +11 -11
  20. data/spec/components/blacklight/constraints_component_spec.rb +9 -9
  21. data/spec/components/blacklight/document/group_component_spec.rb +3 -3
  22. data/spec/components/blacklight/document/sidebar_component_spec.rb +3 -4
  23. data/spec/components/blacklight/document_component_spec.rb +21 -25
  24. data/spec/components/blacklight/facet_component_spec.rb +2 -2
  25. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +5 -5
  26. data/spec/components/blacklight/facet_field_list_component_spec.rb +13 -13
  27. data/spec/components/blacklight/facet_item_component_spec.rb +5 -5
  28. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +6 -6
  29. data/spec/components/blacklight/header_component_spec.rb +1 -2
  30. data/spec/components/blacklight/hidden_search_state_component_spec.rb +6 -6
  31. data/spec/components/blacklight/metadata_field_component_spec.rb +3 -3
  32. data/spec/components/blacklight/response/pagination_component_spec.rb +4 -4
  33. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +1 -1
  34. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +1 -3
  35. data/spec/components/blacklight/system/flash_message_component_spec.rb +5 -5
  36. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  37. data/spec/controllers/blacklight/{catalog/component_configuration_spec.rb → configurable_spec.rb} +1 -1
  38. data/spec/controllers/bookmarks_controller_spec.rb +10 -10
  39. data/spec/controllers/catalog_controller_spec.rb +24 -26
  40. data/spec/features/advanced_search_spec.rb +14 -14
  41. data/spec/features/alternate_controller_spec.rb +9 -9
  42. data/spec/features/axe_spec.rb +4 -4
  43. data/spec/features/bookmarks_spec.rb +19 -19
  44. data/spec/features/citation_spec.rb +1 -1
  45. data/spec/features/did_you_mean_spec.rb +23 -23
  46. data/spec/features/facet_missing_spec.rb +9 -9
  47. data/spec/features/facets_spec.rb +21 -20
  48. data/spec/features/modal_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +2 -2
  50. data/spec/features/search_context_spec.rb +6 -6
  51. data/spec/features/search_crawler_spec.rb +5 -5
  52. data/spec/features/search_filters_spec.rb +65 -65
  53. data/spec/features/search_history_spec.rb +12 -12
  54. data/spec/features/search_pagination_spec.rb +10 -10
  55. data/spec/features/search_results_spec.rb +1 -1
  56. data/spec/features/search_sort_spec.rb +4 -4
  57. data/spec/features/search_spec.rb +25 -25
  58. data/spec/features/sitelinks_search_box_spec.rb +2 -2
  59. data/spec/features/sms_spec.rb +1 -1
  60. data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
  61. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +2 -1
  62. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +7 -8
  63. data/spec/helpers/blacklight_helper_spec.rb +13 -15
  64. data/spec/helpers/catalog_helper_spec.rb +3 -6
  65. data/spec/i18n_spec.rb +2 -1
  66. data/spec/lib/blacklight/search_state_spec.rb +4 -4
  67. data/spec/lib/tasks/blacklight_task_spec.rb +2 -1
  68. data/spec/models/blacklight/configurable_spec.rb +1 -1
  69. data/spec/models/blacklight/configuration/context_spec.rb +1 -1
  70. data/spec/models/blacklight/configuration_spec.rb +2 -2
  71. data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -1
  72. data/spec/models/blacklight/document/cache_key_spec.rb +1 -1
  73. data/spec/models/blacklight/document_spec.rb +1 -1
  74. data/spec/models/blacklight/facet_paginator_spec.rb +14 -14
  75. data/spec/models/blacklight/icon_spec.rb +1 -1
  76. data/spec/models/blacklight/search_builder_spec.rb +1 -1
  77. data/spec/models/blacklight/solr/document_spec.rb +1 -1
  78. data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -1
  79. data/spec/models/blacklight/solr/repository_spec.rb +2 -2
  80. data/spec/models/blacklight/solr/request_spec.rb +1 -1
  81. data/spec/models/blacklight/solr/response/facets_spec.rb +1 -1
  82. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
  83. data/spec/models/blacklight/solr/response/group_spec.rb +1 -1
  84. data/spec/models/blacklight/solr/response_spec.rb +1 -1
  85. data/spec/models/blacklight/solr/{search_builder_spec.rb → search_builder_behavior_spec.rb} +9 -19
  86. data/spec/models/blacklight/suggest/response_spec.rb +1 -1
  87. data/spec/models/blacklight/suggest_search_spec.rb +1 -1
  88. data/spec/models/blacklight/user_spec.rb +1 -1
  89. data/spec/models/solr_document_spec.rb +1 -1
  90. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -2
  91. data/spec/presenters/blacklight/field_presenter_spec.rb +1 -1
  92. data/spec/presenters/blacklight/index_presenter_spec.rb +2 -3
  93. data/spec/presenters/blacklight/json_presenter_spec.rb +1 -1
  94. data/spec/presenters/{pipeline_spec.rb → blacklight/rendering/pipeline_spec.rb} +1 -1
  95. data/spec/presenters/blacklight/show_presenter_spec.rb +5 -6
  96. data/spec/presenters/{thumbnail_presenter_spec.rb → blacklight/thumbnail_presenter_spec.rb} +5 -3
  97. data/spec/routing/catalog_routing_spec.rb +1 -1
  98. data/spec/services/blacklight/field_retriever_spec.rb +1 -1
  99. data/spec/services/blacklight/search_service_spec.rb +9 -9
  100. data/spec/spec_helper.rb +2 -2
  101. data/spec/support/features/search_helpers.rb +2 -2
  102. data/spec/support/features/session_helpers.rb +3 -3
  103. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
  104. data/spec/views/catalog/_document.html.erb_spec.rb +1 -4
  105. data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -2
  106. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -6
  107. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +7 -7
  108. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +4 -4
  109. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -4
  110. data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -2
  111. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -7
  112. data/spec/views/catalog/email_success.html.erb_spec.rb +1 -1
  113. data/spec/views/catalog/facet.html.erb_spec.rb +1 -1
  114. data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
  115. data/spec/views/catalog/index.atom.builder_spec.rb +18 -19
  116. data/spec/views/catalog/index.html.erb_spec.rb +2 -4
  117. data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -8
  118. data/spec/views/catalog/show.html.erb_spec.rb +3 -5
  119. data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -2
  120. data/spec/views/catalog/sms_success.html.erb_spec.rb +1 -1
  121. data/spec/views/shared/_user_util_links.html.erb_spec.rb +2 -3
  122. metadata +10 -10
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.2
4
+ version: 8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2024-06-06 00:00:00.000000000 Z
20
+ date: 2024-06-07 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -778,8 +778,8 @@ files:
778
778
  - spec/components/blacklight/system/flash_message_component_spec.rb
779
779
  - spec/controllers/alternate_controller_spec.rb
780
780
  - spec/controllers/application_controller_spec.rb
781
- - spec/controllers/blacklight/catalog/component_configuration_spec.rb
782
781
  - spec/controllers/blacklight/catalog_spec.rb
782
+ - spec/controllers/blacklight/configurable_spec.rb
783
783
  - spec/controllers/bookmarks_controller_spec.rb
784
784
  - spec/controllers/catalog_controller_spec.rb
785
785
  - spec/controllers/search_history_controller_spec.rb
@@ -848,7 +848,7 @@ files:
848
848
  - spec/models/blacklight/solr/response/group_response_spec.rb
849
849
  - spec/models/blacklight/solr/response/group_spec.rb
850
850
  - spec/models/blacklight/solr/response_spec.rb
851
- - spec/models/blacklight/solr/search_builder_spec.rb
851
+ - spec/models/blacklight/solr/search_builder_behavior_spec.rb
852
852
  - spec/models/blacklight/suggest/response_spec.rb
853
853
  - spec/models/blacklight/suggest_search_spec.rb
854
854
  - spec/models/blacklight/user_spec.rb
@@ -865,9 +865,9 @@ files:
865
865
  - spec/presenters/blacklight/index_presenter_spec.rb
866
866
  - spec/presenters/blacklight/json_presenter_spec.rb
867
867
  - spec/presenters/blacklight/link_alternate_presenter_spec.rb
868
+ - spec/presenters/blacklight/rendering/pipeline_spec.rb
868
869
  - spec/presenters/blacklight/show_presenter_spec.rb
869
- - spec/presenters/pipeline_spec.rb
870
- - spec/presenters/thumbnail_presenter_spec.rb
870
+ - spec/presenters/blacklight/thumbnail_presenter_spec.rb
871
871
  - spec/requests/load_suggestions_spec.rb
872
872
  - spec/routing/catalog_routing_spec.rb
873
873
  - spec/routing/search_history_spec.rb
@@ -957,8 +957,8 @@ test_files:
957
957
  - spec/components/blacklight/system/flash_message_component_spec.rb
958
958
  - spec/controllers/alternate_controller_spec.rb
959
959
  - spec/controllers/application_controller_spec.rb
960
- - spec/controllers/blacklight/catalog/component_configuration_spec.rb
961
960
  - spec/controllers/blacklight/catalog_spec.rb
961
+ - spec/controllers/blacklight/configurable_spec.rb
962
962
  - spec/controllers/bookmarks_controller_spec.rb
963
963
  - spec/controllers/catalog_controller_spec.rb
964
964
  - spec/controllers/search_history_controller_spec.rb
@@ -1027,7 +1027,7 @@ test_files:
1027
1027
  - spec/models/blacklight/solr/response/group_response_spec.rb
1028
1028
  - spec/models/blacklight/solr/response/group_spec.rb
1029
1029
  - spec/models/blacklight/solr/response_spec.rb
1030
- - spec/models/blacklight/solr/search_builder_spec.rb
1030
+ - spec/models/blacklight/solr/search_builder_behavior_spec.rb
1031
1031
  - spec/models/blacklight/suggest/response_spec.rb
1032
1032
  - spec/models/blacklight/suggest_search_spec.rb
1033
1033
  - spec/models/blacklight/user_spec.rb
@@ -1044,9 +1044,9 @@ test_files:
1044
1044
  - spec/presenters/blacklight/index_presenter_spec.rb
1045
1045
  - spec/presenters/blacklight/json_presenter_spec.rb
1046
1046
  - spec/presenters/blacklight/link_alternate_presenter_spec.rb
1047
+ - spec/presenters/blacklight/rendering/pipeline_spec.rb
1047
1048
  - spec/presenters/blacklight/show_presenter_spec.rb
1048
- - spec/presenters/pipeline_spec.rb
1049
- - spec/presenters/thumbnail_presenter_spec.rb
1049
+ - spec/presenters/blacklight/thumbnail_presenter_spec.rb
1050
1050
  - spec/requests/load_suggestions_spec.rb
1051
1051
  - spec/routing/catalog_routing_spec.rb
1052
1052
  - spec/routing/search_history_spec.rb