blacklight 7.22.2 → 7.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +29 -8
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +6 -0
- data/app/components/blacklight/advanced_search_form_component.rb +5 -5
- data/app/components/blacklight/constraints_component.html.erb +8 -4
- data/app/components/blacklight/constraints_component.rb +43 -18
- data/app/components/blacklight/document/action_component.html.erb +1 -1
- data/app/components/blacklight/document/action_component.rb +10 -3
- data/app/components/blacklight/document/bookmark_component.rb +2 -2
- data/app/components/blacklight/document/citation_component.rb +1 -1
- data/app/components/blacklight/document/group_component.html.erb +1 -1
- data/app/components/blacklight/document/group_component.rb +2 -2
- data/app/components/blacklight/document/more_like_this_component.html.erb +1 -1
- data/app/components/blacklight/document/more_like_this_component.rb +1 -1
- data/app/components/blacklight/document/thumbnail_component.rb +1 -1
- data/app/components/blacklight/document_component.rb +2 -2
- data/app/components/blacklight/document_title_component.rb +3 -3
- data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
- data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +1 -1
- data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_list_component.rb +1 -1
- data/app/components/blacklight/facet_field_pagination_component.html.erb +4 -4
- data/app/components/blacklight/facet_item_component.rb +2 -2
- data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
- data/app/components/blacklight/metadata_field_component.rb +2 -2
- data/app/components/blacklight/response/facet_group_component.html.erb +1 -1
- data/app/components/blacklight/response/facet_group_component.rb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +1 -1
- data/app/components/blacklight/response/sort_component.html.erb +1 -1
- data/app/components/blacklight/response/spellcheck_component.rb +14 -3
- data/app/components/blacklight/response/view_type_button_component.rb +3 -3
- data/app/components/blacklight/response/view_type_component.rb +1 -1
- data/app/components/blacklight/search_bar_component.rb +2 -2
- data/app/components/blacklight/search_context_component.rb +3 -3
- data/app/components/blacklight/search_history_constraint_layout_component.rb +14 -0
- data/app/components/blacklight/start_over_button_component.rb +20 -0
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +2 -2
- data/app/controllers/concerns/blacklight/search_context.rb +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +12 -4
- data/app/helpers/blacklight/catalog_helper_behavior.rb +18 -7
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +12 -1
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +30 -2
- data/app/helpers/blacklight/url_helper_behavior.rb +3 -1
- data/app/javascript/blacklight/modal.js +2 -2
- data/app/models/concerns/blacklight/configurable.rb +1 -1
- data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -1
- data/app/models/concerns/blacklight/document/extensions.rb +1 -1
- data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
- data/app/models/concerns/blacklight/document.rb +1 -1
- data/app/views/catalog/_email_form.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +3 -3
- data/app/views/catalog/_start_over.html.erb +1 -1
- data/app/views/layouts/blacklight/base.html.erb +1 -0
- data/blacklight.gemspec +3 -4
- data/lib/blacklight/configuration/fields.rb +1 -1
- data/lib/blacklight/configuration.rb +2 -1
- data/lib/blacklight/deprecations/engine_configuration.rb +66 -0
- data/lib/blacklight/engine.rb +21 -10
- data/lib/blacklight/exceptions.rb +3 -0
- data/lib/blacklight/search_state/filter_field.rb +4 -4
- data/lib/blacklight/solr/repository.rb +36 -12
- data/lib/blacklight/solr/search_builder_behavior.rb +1 -4
- data/lib/generators/blacklight/assets_generator.rb +14 -10
- data/spec/components/blacklight/constraints_component_spec.rb +68 -0
- data/spec/components/blacklight/document/action_component_spec.rb +2 -1
- data/spec/components/blacklight/document_component_spec.rb +1 -1
- data/spec/components/blacklight/response/spellcheck_component_spec.rb +73 -0
- data/spec/components/blacklight/start_over_button_component_spec.rb +38 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/did_you_mean_spec.rb +21 -0
- data/spec/features/search_context_spec.rb +3 -1
- data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +2 -0
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +3 -3
- data/spec/helpers/blacklight_helper_spec.rb +8 -3
- data/spec/helpers/catalog_helper_spec.rb +6 -2
- data/spec/lib/blacklight/engine_spec.rb +41 -0
- data/spec/models/blacklight/facet_paginator_spec.rb +60 -15
- data/spec/models/blacklight/solr/repository_spec.rb +29 -21
- data/spec/models/blacklight/solr/response/facets_spec.rb +48 -10
- data/spec/presenters/blacklight/facet_item_presenter_spec.rb +1 -1
- data/spec/presenters/blacklight/field_presenter_spec.rb +2 -2
- data/spec/routing/search_history_spec.rb +9 -0
- data/spec/services/blacklight/search_service_spec.rb +8 -0
- data/spec/spec_helper.rb +2 -3
- data/spec/support/controller_level_helpers.rb +8 -0
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -1
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -0
- data/spec/views/catalog/index.html.erb_spec.rb +1 -0
- data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -1
- data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -1
- metadata +21 -22
|
@@ -13,44 +13,89 @@ RSpec.describe Blacklight::FacetPaginator, api: true do
|
|
|
13
13
|
let(:limit) { 6 }
|
|
14
14
|
|
|
15
15
|
context 'on the first page of two pages' do
|
|
16
|
-
subject { described_class.new(seven_facet_values, limit: limit) }
|
|
16
|
+
subject(:paginator) { described_class.new(seven_facet_values, limit: limit) }
|
|
17
17
|
|
|
18
18
|
it { is_expected.to be_first_page }
|
|
19
19
|
it { is_expected.not_to be_last_page }
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
describe '#current_page' do
|
|
22
|
+
subject { paginator.current_page }
|
|
23
|
+
|
|
24
|
+
it { is_expected.to eq 1 }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe '#prev_page' do
|
|
28
|
+
subject { paginator.prev_page }
|
|
29
|
+
|
|
30
|
+
it { is_expected.to be_nil }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe '#next_page' do
|
|
34
|
+
subject { paginator.next_page }
|
|
35
|
+
|
|
36
|
+
it { is_expected.to eq 2 }
|
|
37
|
+
end
|
|
23
38
|
|
|
24
39
|
it 'limits items to limit, if limit is smaller than items.length' do
|
|
25
|
-
expect(
|
|
40
|
+
expect(paginator.items.size).to eq 6
|
|
26
41
|
end
|
|
27
42
|
end
|
|
28
43
|
|
|
29
44
|
context 'on the last page of two pages' do
|
|
30
|
-
subject { described_class.new([f7], offset: 6, limit: limit) }
|
|
45
|
+
subject(:paginator) { described_class.new([f7], offset: 6, limit: limit) }
|
|
31
46
|
|
|
32
47
|
it { is_expected.not_to be_first_page }
|
|
33
48
|
it { is_expected.to be_last_page }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
|
|
50
|
+
describe '#current_page' do
|
|
51
|
+
subject { paginator.current_page }
|
|
52
|
+
|
|
53
|
+
it { is_expected.to eq 2 }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe '#prev_page' do
|
|
57
|
+
subject { paginator.prev_page }
|
|
58
|
+
|
|
59
|
+
it { is_expected.to eq 1 }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe '#next_page' do
|
|
63
|
+
subject { paginator.next_page }
|
|
64
|
+
|
|
65
|
+
it { is_expected.to be_nil }
|
|
66
|
+
end
|
|
37
67
|
|
|
38
68
|
it 'returns all items when limit is greater than items.length' do
|
|
39
|
-
expect(
|
|
69
|
+
expect(paginator.items.size).to eq 1
|
|
40
70
|
end
|
|
41
71
|
end
|
|
42
72
|
|
|
43
73
|
context 'on the second page of three pages' do
|
|
44
|
-
subject { described_class.new(seven_facet_values, offset: 6, limit: limit) }
|
|
74
|
+
subject(:paginator) { described_class.new(seven_facet_values, offset: 6, limit: limit) }
|
|
45
75
|
|
|
46
76
|
it { is_expected.not_to be_first_page }
|
|
47
77
|
it { is_expected.not_to be_last_page }
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
78
|
+
|
|
79
|
+
describe '#current_page' do
|
|
80
|
+
subject { paginator.current_page }
|
|
81
|
+
|
|
82
|
+
it { is_expected.to eq 2 }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe '#prev_page' do
|
|
86
|
+
subject { paginator.prev_page }
|
|
87
|
+
|
|
88
|
+
it { is_expected.to eq 1 }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe '#next_page' do
|
|
92
|
+
subject { paginator.next_page }
|
|
93
|
+
|
|
94
|
+
it { is_expected.to eq 3 }
|
|
95
|
+
end
|
|
51
96
|
|
|
52
97
|
it 'limits items to limit, if limit is smaller than items.length' do
|
|
53
|
-
expect(
|
|
98
|
+
expect(paginator.items.size).to eq 6
|
|
54
99
|
end
|
|
55
100
|
end
|
|
56
101
|
|
|
@@ -9,6 +9,8 @@ RSpec.describe Blacklight::Solr::Repository, api: true do
|
|
|
9
9
|
CatalogController.blacklight_config.deep_copy
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
let(:all_docs_query) { '' }
|
|
13
|
+
|
|
12
14
|
let :mock_response do
|
|
13
15
|
{ response: { docs: [document] } }
|
|
14
16
|
end
|
|
@@ -104,19 +106,30 @@ RSpec.describe Blacklight::Solr::Repository, api: true do
|
|
|
104
106
|
expect(response).to be_a_kind_of Blacklight::Solr::Response
|
|
105
107
|
expect(response.params).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
|
|
106
108
|
end
|
|
109
|
+
|
|
110
|
+
it "calls send_and_receive with params returned from request factory method" do
|
|
111
|
+
expect(blacklight_config.http_method).to eq :get
|
|
112
|
+
input_params = { q: all_docs_query }
|
|
113
|
+
allow(subject.connection).to receive(:send_and_receive) do |path, params|
|
|
114
|
+
expect(path).to eq 'select'
|
|
115
|
+
expect(params[:method]).to eq :get
|
|
116
|
+
expect(params[:params]).to include input_params
|
|
117
|
+
end.and_return('response' => { 'docs' => [] })
|
|
118
|
+
subject.search(input_params)
|
|
119
|
+
end
|
|
107
120
|
end
|
|
108
121
|
|
|
109
|
-
describe "#
|
|
122
|
+
describe "#build_solr_request" do
|
|
123
|
+
let(:input_params) { { q: all_docs_query } }
|
|
124
|
+
let(:actual_params) { subject.build_solr_request(input_params) }
|
|
125
|
+
|
|
110
126
|
describe "http_method configuration" do
|
|
111
127
|
describe "using default" do
|
|
112
128
|
it "defaults to get" do
|
|
113
129
|
expect(blacklight_config.http_method).to eq :get
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
expect(params[:params]).to include(:q)
|
|
118
|
-
end.and_return('response' => { 'docs' => [] })
|
|
119
|
-
subject.search(q: @all_docs_query)
|
|
130
|
+
expect(actual_params[:method]).to eq :get
|
|
131
|
+
expect(actual_params[:params]).to include input_params
|
|
132
|
+
expect(actual_params).not_to have_key :data
|
|
120
133
|
end
|
|
121
134
|
end
|
|
122
135
|
|
|
@@ -125,25 +138,20 @@ RSpec.describe Blacklight::Solr::Repository, api: true do
|
|
|
125
138
|
|
|
126
139
|
it "keep value set to post" do
|
|
127
140
|
expect(blacklight_config.http_method).to eq :post
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
expect(params[:data]).to include(:q)
|
|
132
|
-
end.and_return('response' => { 'docs' => [] })
|
|
133
|
-
subject.search(q: @all_docs_query)
|
|
141
|
+
expect(actual_params[:method]).to eq :post
|
|
142
|
+
expect(actual_params[:data]).to include input_params
|
|
143
|
+
expect(actual_params).not_to have_key :params
|
|
134
144
|
end
|
|
135
145
|
end
|
|
136
146
|
end
|
|
137
147
|
|
|
138
148
|
context 'with json parameters' do
|
|
149
|
+
let(:input_params) { { json: { query: { bool: {} } } } }
|
|
150
|
+
|
|
139
151
|
it 'sends a post request with some json' do
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
expect(JSON.parse(params[:data]).with_indifferent_access).to include(query: { bool: {} })
|
|
144
|
-
expect(params[:headers]).to include({ 'Content-Type' => 'application/json' })
|
|
145
|
-
end.and_return('response' => { 'docs' => [] })
|
|
146
|
-
subject.search(json: { query: { bool: {} } })
|
|
152
|
+
expect(actual_params[:method]).to eq :post
|
|
153
|
+
expect(JSON.parse(actual_params[:data]).with_indifferent_access).to include(query: { bool: {} })
|
|
154
|
+
expect(actual_params[:headers]).to include({ 'Content-Type' => 'application/json' })
|
|
147
155
|
end
|
|
148
156
|
end
|
|
149
157
|
end
|
|
@@ -152,7 +160,7 @@ RSpec.describe Blacklight::Solr::Repository, api: true do
|
|
|
152
160
|
let (:blacklight_config) { config = Blacklight::Configuration.new; config.http_method = :post; config }
|
|
153
161
|
|
|
154
162
|
it "sends a post request to solr and get a response back" do
|
|
155
|
-
response = subject.search(q:
|
|
163
|
+
response = subject.search(q: all_docs_query)
|
|
156
164
|
expect(response.docs.length).to be >= 1
|
|
157
165
|
end
|
|
158
166
|
end
|
|
@@ -3,21 +3,59 @@
|
|
|
3
3
|
RSpec.describe Blacklight::Solr::Response::Facets, api: true do
|
|
4
4
|
describe Blacklight::Solr::Response::Facets::FacetField do
|
|
5
5
|
describe "A field with default options" do
|
|
6
|
-
subject { described_class.new "my_field", [] }
|
|
6
|
+
subject(:field) { described_class.new "my_field", [] }
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
describe '#name' do
|
|
9
|
+
subject { field.name }
|
|
10
|
+
|
|
11
|
+
it { is_expected.to eq "my_field" }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#limit' do
|
|
15
|
+
subject { field.limit }
|
|
16
|
+
|
|
17
|
+
it { is_expected.to eq 100 }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#sort' do
|
|
21
|
+
subject { field.sort }
|
|
22
|
+
|
|
23
|
+
it { is_expected.to eq 'count' }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe '#offset' do
|
|
27
|
+
subject { field.offset }
|
|
28
|
+
|
|
29
|
+
it { is_expected.to eq 0 }
|
|
30
|
+
end
|
|
12
31
|
end
|
|
13
32
|
|
|
14
33
|
describe "A field with additional options" do
|
|
15
|
-
subject { described_class.new "my_field", [], limit: 15, sort: 'alpha', offset: 23 }
|
|
34
|
+
subject(:field) { described_class.new "my_field", [], limit: 15, sort: 'alpha', offset: 23 }
|
|
16
35
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
describe '#name' do
|
|
37
|
+
subject { field.name }
|
|
38
|
+
|
|
39
|
+
it { is_expected.to eq "my_field" }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#limit' do
|
|
43
|
+
subject { field.limit }
|
|
44
|
+
|
|
45
|
+
it { is_expected.to eq 15 }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe '#sort' do
|
|
49
|
+
subject { field.sort }
|
|
50
|
+
|
|
51
|
+
it { is_expected.to eq 'alpha' }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe '#offset' do
|
|
55
|
+
subject { field.offset }
|
|
56
|
+
|
|
57
|
+
it { is_expected.to eq 23 }
|
|
58
|
+
end
|
|
21
59
|
end
|
|
22
60
|
end
|
|
23
61
|
|
|
@@ -62,7 +62,7 @@ RSpec.describe Blacklight::FacetItemPresenter, type: :presenter do
|
|
|
62
62
|
|
|
63
63
|
it 'is the url to apply the facet' do
|
|
64
64
|
allow(search_state).to receive(:add_facet_params_and_redirect).with('key', facet_item).and_return(f: 'x')
|
|
65
|
-
allow(view_context).to receive(:search_action_path).with(f: 'x').and_return('/catalog?f=x')
|
|
65
|
+
allow(view_context).to receive(:search_action_path).with({ f: 'x' }).and_return('/catalog?f=x')
|
|
66
66
|
|
|
67
67
|
expect(presenter.href).to eq '/catalog?f=x'
|
|
68
68
|
end
|
|
@@ -81,7 +81,7 @@ RSpec.describe Blacklight::FieldPresenter, api: true do
|
|
|
81
81
|
|
|
82
82
|
context 'when field has link_to_facet with true' do
|
|
83
83
|
before do
|
|
84
|
-
allow(request_context).to receive(:search_action_path).with('f' => { 'link_to_facet_true' => ['x'] }).and_return('/foo')
|
|
84
|
+
allow(request_context).to receive(:search_action_path).with({ 'f' => { 'link_to_facet_true' => ['x'] } }).and_return('/foo')
|
|
85
85
|
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -92,7 +92,7 @@ RSpec.describe Blacklight::FieldPresenter, api: true do
|
|
|
92
92
|
|
|
93
93
|
context 'when field has link_to_facet with a field name' do
|
|
94
94
|
before do
|
|
95
|
-
allow(request_context).to receive(:search_action_path).with('f' => { 'some_field' => ['x'] }).and_return('/foo')
|
|
95
|
+
allow(request_context).to receive(:search_action_path).with({ 'f' => { 'some_field' => ['x'] } }).and_return('/foo')
|
|
96
96
|
allow(request_context).to receive(:link_to).with("x", '/foo').and_return('bar')
|
|
97
97
|
end
|
|
98
98
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Search History Routes" do
|
|
4
|
+
routes { Blacklight::Engine.routes }
|
|
5
|
+
# paths generated by custom routes
|
|
6
|
+
it "has a path for showing the search history" do
|
|
7
|
+
expect(get: "/search_history").to route_to(controller: 'search_history', action: 'index')
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -421,6 +421,14 @@ RSpec.describe Blacklight::SearchService, api: true do
|
|
|
421
421
|
expect { service.repository.search }.to raise_exception(/Unable to connect to Solr instance/)
|
|
422
422
|
end
|
|
423
423
|
|
|
424
|
+
it "raises a Blacklight exception if RSolr raises a timeout error connecting to Solr instance" do
|
|
425
|
+
rsolr_timeout = RSolr::Error::Timeout.new(nil, nil)
|
|
426
|
+
allow(rsolr_timeout).to receive(:to_s).and_return("mocked RSolr timeout")
|
|
427
|
+
|
|
428
|
+
allow(blacklight_solr).to receive(:send_and_receive).and_raise(rsolr_timeout)
|
|
429
|
+
expect { service.repository.search }.to raise_exception(Blacklight::Exceptions::RepositoryTimeout, /Timeout connecting to Solr instance/)
|
|
430
|
+
end
|
|
431
|
+
|
|
424
432
|
describe "#previous_and_next_documents_for_search" do
|
|
425
433
|
let(:user_params) { { q: '', per_page: 100 } }
|
|
426
434
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -14,7 +14,6 @@ require 'engine_cart'
|
|
|
14
14
|
EngineCart.load_application!
|
|
15
15
|
|
|
16
16
|
require 'rspec/rails'
|
|
17
|
-
require 'rspec/its'
|
|
18
17
|
require 'rspec/collection_matchers'
|
|
19
18
|
require 'capybara/rails'
|
|
20
19
|
require 'webdrivers'
|
|
@@ -29,13 +28,13 @@ Capybara.javascript_driver = :headless_chrome
|
|
|
29
28
|
|
|
30
29
|
Capybara.register_driver :headless_chrome do |app|
|
|
31
30
|
Capybara::Selenium::Driver.load_selenium
|
|
32
|
-
|
|
31
|
+
capabilities = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
|
|
33
32
|
opts.args << '--headless'
|
|
34
33
|
opts.args << '--disable-gpu'
|
|
35
34
|
opts.args << '--no-sandbox'
|
|
36
35
|
opts.args << '--window-size=1280,1696'
|
|
37
36
|
end
|
|
38
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome,
|
|
37
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: capabilities)
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
@@ -15,4 +15,12 @@ module ControllerLevelHelpers
|
|
|
15
15
|
def initialize_controller_helpers(helper)
|
|
16
16
|
helper.extend ControllerViewHelpers
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
# Monkeypatch to fix https://github.com/rspec/rspec-rails/pull/2521
|
|
20
|
+
def _default_render_options
|
|
21
|
+
val = super
|
|
22
|
+
return val unless val[:handlers]
|
|
23
|
+
|
|
24
|
+
val.merge(handlers: val.fetch(:handlers).map(&:to_sym))
|
|
25
|
+
end
|
|
18
26
|
end
|
|
@@ -23,7 +23,7 @@ RSpec.describe "catalog/constraints" do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "renders a start over link with the current view type" do
|
|
26
|
-
allow(view).to receive(:search_action_path).with(view: :xyz).and_return('http://xyz?view=xyz')
|
|
26
|
+
allow(view).to receive(:search_action_path).with({ view: :xyz }).and_return('http://xyz?view=xyz')
|
|
27
27
|
allow(view).to receive_messages(query_has_constraints?: true)
|
|
28
28
|
params[:view] = 'xyz'
|
|
29
29
|
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# spec for sidebar partial in catalog show view
|
|
4
4
|
|
|
5
|
-
RSpec.describe "
|
|
5
|
+
RSpec.describe "catalog/_show_sidebar.html.erb" do
|
|
6
6
|
let(:blacklight_config) do
|
|
7
7
|
Blacklight::Configuration.new do |config|
|
|
8
8
|
config.index.title_field = 'title_tsim'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
RSpec.describe "catalog/facet.json", api: true do
|
|
4
4
|
it "renders facet json" do
|
|
5
5
|
assign :pagination, items: [{ value: 'Book' }]
|
|
6
|
-
render template: "catalog/facet
|
|
6
|
+
render template: "catalog/facet", formats: [:json]
|
|
7
7
|
hash = JSON.parse(rendered)
|
|
8
8
|
expect(hash).to eq('response' => { 'facets' => { 'items' => [{ 'value' => 'Book' }] } })
|
|
9
9
|
end
|
|
@@ -16,6 +16,7 @@ RSpec.describe "catalog/index" do
|
|
|
16
16
|
|
|
17
17
|
before do
|
|
18
18
|
@response = Blacklight::Solr::Response.new({ response: { numFound: 30 } }, start: 10, rows: 10)
|
|
19
|
+
allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
|
|
19
20
|
allow(@response).to receive(:documents).and_return(document_list)
|
|
20
21
|
params['content_format'] = 'some_format'
|
|
21
22
|
allow(view).to receive(:action_name).and_return('index')
|
|
@@ -18,6 +18,7 @@ RSpec.describe "catalog/index.html.erb" do
|
|
|
18
18
|
|
|
19
19
|
describe "with search parameters" do
|
|
20
20
|
before do
|
|
21
|
+
allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
|
|
21
22
|
allow(view).to receive(:has_search_parameters?).and_return(true)
|
|
22
23
|
stub_template "catalog/_results_pagination.html.erb" => ""
|
|
23
24
|
stub_template "catalog/_search_header.html.erb" => "header_content"
|
|
@@ -16,7 +16,7 @@ RSpec.describe "catalog/index.json", api: true do
|
|
|
16
16
|
let(:presenter) { Blacklight::JsonPresenter.new(response, config) }
|
|
17
17
|
|
|
18
18
|
let(:hash) do
|
|
19
|
-
render template: "catalog/index
|
|
19
|
+
render template: "catalog/index", formats: [:json]
|
|
20
20
|
JSON.parse(rendered).with_indifferent_access
|
|
21
21
|
end
|
|
22
22
|
|
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: 7.
|
|
4
|
+
version: 7.23.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:
|
|
20
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
23
23
|
name: rails
|
|
@@ -28,7 +28,7 @@ dependencies:
|
|
|
28
28
|
version: '5.1'
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '7'
|
|
31
|
+
version: '7.1'
|
|
32
32
|
type: :runtime
|
|
33
33
|
prerelease: false
|
|
34
34
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
version: '5.1'
|
|
39
39
|
- - "<"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '7'
|
|
41
|
+
version: '7.1'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: globalid
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -129,14 +129,14 @@ dependencies:
|
|
|
129
129
|
requirements:
|
|
130
130
|
- - "~>"
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
version: '2.
|
|
132
|
+
version: '2.43'
|
|
133
133
|
type: :runtime
|
|
134
134
|
prerelease: false
|
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
136
|
requirements:
|
|
137
137
|
- - "~>"
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: '2.
|
|
139
|
+
version: '2.43'
|
|
140
140
|
- !ruby/object:Gem::Dependency
|
|
141
141
|
name: rsolr
|
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -163,28 +163,14 @@ dependencies:
|
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version:
|
|
166
|
+
version: '5.0'
|
|
167
167
|
type: :development
|
|
168
168
|
prerelease: false
|
|
169
169
|
version_requirements: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
171
|
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version:
|
|
174
|
-
- !ruby/object:Gem::Dependency
|
|
175
|
-
name: rspec-its
|
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
|
177
|
-
requirements:
|
|
178
|
-
- - ">="
|
|
179
|
-
- !ruby/object:Gem::Version
|
|
180
|
-
version: '0'
|
|
181
|
-
type: :development
|
|
182
|
-
prerelease: false
|
|
183
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
184
|
-
requirements:
|
|
185
|
-
- - ">="
|
|
186
|
-
- !ruby/object:Gem::Version
|
|
187
|
-
version: '0'
|
|
173
|
+
version: '5.0'
|
|
188
174
|
- !ruby/object:Gem::Dependency
|
|
189
175
|
name: rspec-collection_matchers
|
|
190
176
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -489,6 +475,8 @@ files:
|
|
|
489
475
|
- app/components/blacklight/search_bar_component.rb
|
|
490
476
|
- app/components/blacklight/search_context_component.html.erb
|
|
491
477
|
- app/components/blacklight/search_context_component.rb
|
|
478
|
+
- app/components/blacklight/search_history_constraint_layout_component.rb
|
|
479
|
+
- app/components/blacklight/start_over_button_component.rb
|
|
492
480
|
- app/components/blacklight/system/dropdown_component.html.erb
|
|
493
481
|
- app/components/blacklight/system/dropdown_component.rb
|
|
494
482
|
- app/components/blacklight/system/flash_message_component.html.erb
|
|
@@ -703,6 +691,7 @@ files:
|
|
|
703
691
|
- lib/blacklight/configuration/sort_field.rb
|
|
704
692
|
- lib/blacklight/configuration/tool_config.rb
|
|
705
693
|
- lib/blacklight/configuration/view_config.rb
|
|
694
|
+
- lib/blacklight/deprecations/engine_configuration.rb
|
|
706
695
|
- lib/blacklight/engine.rb
|
|
707
696
|
- lib/blacklight/exceptions.rb
|
|
708
697
|
- lib/blacklight/nested_open_struct_with_hash_access.rb
|
|
@@ -769,6 +758,7 @@ files:
|
|
|
769
758
|
- package.json
|
|
770
759
|
- spec/components/blacklight/advanced_search_form_component_spec.rb
|
|
771
760
|
- spec/components/blacklight/constraint_layout_component_spec.rb
|
|
761
|
+
- spec/components/blacklight/constraints_component_spec.rb
|
|
772
762
|
- spec/components/blacklight/document/action_component_spec.rb
|
|
773
763
|
- spec/components/blacklight/document/group_component_spec.rb
|
|
774
764
|
- spec/components/blacklight/document_component_spec.rb
|
|
@@ -779,6 +769,8 @@ files:
|
|
|
779
769
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
|
780
770
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
|
781
771
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
|
772
|
+
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
|
773
|
+
- spec/components/blacklight/start_over_button_component_spec.rb
|
|
782
774
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
|
783
775
|
- spec/controllers/alternate_controller_spec.rb
|
|
784
776
|
- spec/controllers/application_controller_spec.rb
|
|
@@ -826,6 +818,7 @@ files:
|
|
|
826
818
|
- spec/lib/blacklight/configuration/facet_field_spec.rb
|
|
827
819
|
- spec/lib/blacklight/configuration/field_spec.rb
|
|
828
820
|
- spec/lib/blacklight/configuration/view_config_spec.rb
|
|
821
|
+
- spec/lib/blacklight/engine_spec.rb
|
|
829
822
|
- spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
|
|
830
823
|
- spec/lib/blacklight/open_struct_with_hash_access_spec.rb
|
|
831
824
|
- spec/lib/blacklight/parameters_spec.rb
|
|
@@ -875,6 +868,7 @@ files:
|
|
|
875
868
|
- spec/presenters/pipeline_spec.rb
|
|
876
869
|
- spec/presenters/thumbnail_presenter_spec.rb
|
|
877
870
|
- spec/routing/catalog_routing_spec.rb
|
|
871
|
+
- spec/routing/search_history_spec.rb
|
|
878
872
|
- spec/services/blacklight/search_service_spec.rb
|
|
879
873
|
- spec/spec_helper.rb
|
|
880
874
|
- spec/support/controller_level_helpers.rb
|
|
@@ -943,6 +937,7 @@ summary: Blacklight provides a discovery interface for any Solr (http://lucene.a
|
|
|
943
937
|
test_files:
|
|
944
938
|
- spec/components/blacklight/advanced_search_form_component_spec.rb
|
|
945
939
|
- spec/components/blacklight/constraint_layout_component_spec.rb
|
|
940
|
+
- spec/components/blacklight/constraints_component_spec.rb
|
|
946
941
|
- spec/components/blacklight/document/action_component_spec.rb
|
|
947
942
|
- spec/components/blacklight/document/group_component_spec.rb
|
|
948
943
|
- spec/components/blacklight/document_component_spec.rb
|
|
@@ -953,6 +948,8 @@ test_files:
|
|
|
953
948
|
- spec/components/blacklight/facet_item_pivot_component_spec.rb
|
|
954
949
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
|
955
950
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
|
951
|
+
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
|
952
|
+
- spec/components/blacklight/start_over_button_component_spec.rb
|
|
956
953
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
|
957
954
|
- spec/controllers/alternate_controller_spec.rb
|
|
958
955
|
- spec/controllers/application_controller_spec.rb
|
|
@@ -1000,6 +997,7 @@ test_files:
|
|
|
1000
997
|
- spec/lib/blacklight/configuration/facet_field_spec.rb
|
|
1001
998
|
- spec/lib/blacklight/configuration/field_spec.rb
|
|
1002
999
|
- spec/lib/blacklight/configuration/view_config_spec.rb
|
|
1000
|
+
- spec/lib/blacklight/engine_spec.rb
|
|
1003
1001
|
- spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
|
|
1004
1002
|
- spec/lib/blacklight/open_struct_with_hash_access_spec.rb
|
|
1005
1003
|
- spec/lib/blacklight/parameters_spec.rb
|
|
@@ -1049,6 +1047,7 @@ test_files:
|
|
|
1049
1047
|
- spec/presenters/pipeline_spec.rb
|
|
1050
1048
|
- spec/presenters/thumbnail_presenter_spec.rb
|
|
1051
1049
|
- spec/routing/catalog_routing_spec.rb
|
|
1050
|
+
- spec/routing/search_history_spec.rb
|
|
1052
1051
|
- spec/services/blacklight/search_service_spec.rb
|
|
1053
1052
|
- spec/spec_helper.rb
|
|
1054
1053
|
- spec/support/controller_level_helpers.rb
|