Skip to content

Commit 9fe582b

Browse files
authored
Merge pull request #2122 from projectblacklight/update-rubocop-rspec
Update rubocop-rspec
2 parents ce84d78 + 20e1e4b commit 9fe582b

File tree

6 files changed

+49
-38
lines changed

6 files changed

+49
-38
lines changed

.rubocop_todo.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2019-01-18 23:13:39 -0600 using RuboCop version 0.63.0.
3+
# on 2019-08-05 11:45:43 -0500 using RuboCop version 0.63.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -36,7 +36,7 @@ Layout/ClosingParenthesisIndentation:
3636
Exclude:
3737
- 'app/views/catalog/index.atom.builder'
3838

39-
# Offense count: 108
39+
# Offense count: 109
4040
# Cop supports --auto-correct.
4141
Layout/EmptyLineAfterMagicComment:
4242
Enabled: false
@@ -69,11 +69,10 @@ Layout/LeadingCommentSpace:
6969
- 'app/models/concerns/blacklight/document/export.rb'
7070
- 'app/views/catalog/_document.atom.builder'
7171

72-
# Offense count: 2
72+
# Offense count: 1
7373
# Cop supports --auto-correct.
7474
Layout/MultilineBlockLayout:
7575
Exclude:
76-
- 'lib/generators/blacklight/install_generator.rb'
7776
- 'lib/generators/blacklight/test_support_generator.rb'
7877

7978
# Offense count: 2
@@ -127,13 +126,12 @@ Layout/SpaceInsideParens:
127126
- 'app/views/catalog/_document.rss.builder'
128127
- 'app/views/catalog/index.atom.builder'
129128

130-
# Offense count: 13
129+
# Offense count: 1
131130
# Cop supports --auto-correct.
132131
# Configuration parameters: AllowInHeredoc.
133132
Layout/TrailingWhitespace:
134133
Exclude:
135134
- 'app/views/catalog/_document.rss.builder'
136-
- 'app/views/catalog/index.atom.builder'
137135

138136
# Offense count: 1
139137
Lint/AmbiguousBlockAssociation:
@@ -211,15 +209,15 @@ Metrics/ClassLength:
211209
Metrics/CyclomaticComplexity:
212210
Max: 12
213211

214-
# Offense count: 47
212+
# Offense count: 48
215213
# Configuration parameters: CountComments, ExcludedMethods.
216214
Metrics/MethodLength:
217215
Max: 35
218216

219217
# Offense count: 8
220218
# Configuration parameters: CountComments.
221219
Metrics/ModuleLength:
222-
Max: 215
220+
Max: 210
223221

224222
# Offense count: 1
225223
# Configuration parameters: CountKeywordArgs.
@@ -255,7 +253,7 @@ Naming/UncommunicativeMethodParamName:
255253
- 'spec/features/search_context_spec.rb'
256254
- 'spec/features/search_results_spec.rb'
257255

258-
# Offense count: 15
256+
# Offense count: 16
259257
# Configuration parameters: EnforcedStyle.
260258
# SupportedStyles: snake_case, normalcase, non_integer
261259
Naming/VariableNumber:
@@ -332,7 +330,7 @@ RSpec/FilePath:
332330
- 'spec/presenters/pipeline_spec.rb'
333331
- 'spec/presenters/thumbnail_presenter_spec.rb'
334332

335-
# Offense count: 194
333+
# Offense count: 197
336334
# Configuration parameters: AssignmentOnly.
337335
RSpec/InstanceVariable:
338336
Enabled: false
@@ -344,6 +342,18 @@ RSpec/IteratedExpectation:
344342
- 'spec/models/blacklight/solr/response/group_spec.rb'
345343
- 'spec/models/blacklight/solr/response_spec.rb'
346344

345+
# Offense count: 17
346+
RSpec/LeakyConstantDeclaration:
347+
Exclude:
348+
- 'spec/controllers/blacklight/search_fields_spec.rb'
349+
- 'spec/controllers/bookmarks_controller_spec.rb'
350+
- 'spec/controllers/catalog_controller_spec.rb'
351+
- 'spec/models/blacklight/configurable_spec.rb'
352+
- 'spec/models/blacklight/document/active_model_shim_spec.rb'
353+
- 'spec/models/blacklight/document_spec.rb'
354+
- 'spec/models/blacklight/solr/document_spec.rb'
355+
- 'spec/presenters/blacklight/show_presenter_spec.rb'
356+
347357
# Offense count: 8
348358
RSpec/MessageChain:
349359
Exclude:
@@ -371,12 +381,12 @@ RSpec/MessageSpies:
371381
- 'spec/presenters/blacklight/show_presenter_spec.rb'
372382
- 'spec/presenters/thumbnail_presenter_spec.rb'
373383

374-
# Offense count: 345
384+
# Offense count: 346
375385
# Configuration parameters: AggregateFailuresByDefault.
376386
RSpec/MultipleExpectations:
377387
Max: 16
378388

379-
# Offense count: 328
389+
# Offense count: 329
380390
# Configuration parameters: IgnoreSharedExamples.
381391
RSpec/NamedSubject:
382392
Enabled: false
@@ -406,13 +416,14 @@ RSpec/ScatteredLet:
406416
- 'spec/models/blacklight/solr/search_builder_spec.rb'
407417
- 'spec/views/catalog/index.atom.builder_spec.rb'
408418

409-
# Offense count: 4
419+
# Offense count: 10
410420
RSpec/SubjectStub:
411421
Exclude:
412422
- 'spec/lib/blacklight/search_state_spec.rb'
423+
- 'spec/models/blacklight/search_builder_spec.rb'
413424
- 'spec/services/blacklight/search_service_spec.rb'
414425

415-
# Offense count: 118
426+
# Offense count: 119
416427
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
417428
RSpec/VerifiedDoubles:
418429
Enabled: false
@@ -476,7 +487,7 @@ Style/BracesAroundHashParameters:
476487
- 'lib/blacklight/solr/response/facets.rb'
477488
- 'lib/generators/blacklight/test_support_generator.rb'
478489

479-
# Offense count: 50
490+
# Offense count: 51
480491
# Cop supports --auto-correct.
481492
# Configuration parameters: AutoCorrect, EnforcedStyle.
482493
# SupportedStyles: nested, compact
@@ -497,7 +508,7 @@ Style/ConditionalAssignment:
497508
Exclude:
498509
- 'lib/blacklight/solr/response/spelling.rb'
499510

500-
# Offense count: 93
511+
# Offense count: 94
501512
Style/Documentation:
502513
Enabled: false
503514

spec/models/blacklight/document/cache_key_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let(:subject) { SolrDocument.new(attributes) }
66

77
it 'SolrDocument includes the module' do
8-
expect(subject.class).to include(Blacklight::Document::CacheKey)
8+
expect(subject.class).to include(described_class)
99
end
1010

1111
describe 'new record' do

spec/models/blacklight/solr/response/facets_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RSpec.describe Blacklight::Solr::Response::Facets, api: true do
44
describe Blacklight::Solr::Response::Facets::FacetField do
55
describe "A field with default options" do
6-
subject { Blacklight::Solr::Response::Facets::FacetField.new "my_field", [] }
6+
subject { described_class.new "my_field", [] }
77

88
its(:name) { is_expected.to eq "my_field" }
99
its(:limit) { is_expected.to eq 100 }
@@ -12,7 +12,7 @@
1212
end
1313

1414
describe "A field with additional options" do
15-
subject { Blacklight::Solr::Response::Facets::FacetField.new "my_field", [], limit: 15, sort: 'alpha', offset: 23 }
15+
subject { described_class.new "my_field", [], limit: 15, sort: 'alpha', offset: 23 }
1616

1717
its(:name) { is_expected.to eq "my_field" }
1818
its(:limit) { is_expected.to eq 15 }

spec/models/blacklight/solr/response_spec.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
let(:config) { Blacklight::Configuration.new }
77

88
let(:r) do
9-
Blacklight::Solr::Response.new(raw_response,
10-
raw_response['params'],
11-
blacklight_config: config)
9+
described_class.new(raw_response,
10+
raw_response['params'],
11+
blacklight_config: config)
1212
end
1313

1414
it 'creates a valid response' do
@@ -113,99 +113,99 @@
113113
it 'provides the responseHeader params' do
114114
raw_response = eval(mock_query_response)
115115
raw_response['responseHeader']['params']['test'] = :test
116-
r = Blacklight::Solr::Response.new(raw_response, raw_response['params'])
116+
r = described_class.new(raw_response, raw_response['params'])
117117
expect(r.params['test']).to eq :test
118118
end
119119

120120
it 'provides the solr-returned params and "rows" should be 11' do
121121
raw_response = eval(mock_query_response)
122-
r = Blacklight::Solr::Response.new(raw_response, {})
122+
r = described_class.new(raw_response, {})
123123
expect(r.params[:rows].to_s).to eq '11'
124124
expect(r.params[:sort]).to eq 'title_si asc, pub_date_si desc'
125125
end
126126

127127
it 'provides the ruby request params if responseHeader["params"] does not exist' do
128128
raw_response = eval(mock_query_response)
129129
raw_response.delete 'responseHeader'
130-
r = Blacklight::Solr::Response.new(raw_response, rows: 999, sort: 'score desc, pub_date_si desc, title_si asc')
130+
r = described_class.new(raw_response, rows: 999, sort: 'score desc, pub_date_si desc, title_si asc')
131131
expect(r.params[:rows].to_s).to eq '999'
132132
expect(r.params[:sort]).to eq 'score desc, pub_date_si desc, title_si asc'
133133
end
134134

135135
it 'provides spelling suggestions for regular spellcheck results' do
136136
raw_response = eval(mock_response_with_spellcheck)
137-
r = Blacklight::Solr::Response.new(raw_response, {})
137+
r = described_class.new(raw_response, {})
138138
expect(r.spelling.words).to include("dell")
139139
expect(r.spelling.words).to include("ultrasharp")
140140
end
141141

142142
it 'provides spelling suggestions for extended spellcheck results' do
143143
raw_response = eval(mock_response_with_spellcheck_extended)
144-
r = Blacklight::Solr::Response.new(raw_response, {})
144+
r = described_class.new(raw_response, {})
145145
expect(r.spelling.words).to include("dell")
146146
expect(r.spelling.words).to include("ultrasharp")
147147
end
148148

149149
it 'provides no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
150150
raw_response = eval(mock_response_with_spellcheck_same_frequency)
151-
r = Blacklight::Solr::Response.new(raw_response, {})
151+
r = described_class.new(raw_response, {})
152152
expect(r.spelling.words).to eq []
153153
end
154154

155155
context "pre solr 5 spellcheck collation syntax" do
156156
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
157157
raw_response = eval(mock_response_with_spellcheck_collation)
158-
r = Blacklight::Solr::Response.new(raw_response, {})
158+
r = described_class.new(raw_response, {})
159159
expect(r.spelling.words).to include("dell")
160160
expect(r.spelling.words).to include("ultrasharp")
161161
end
162162

163163
it 'provides spelling suggestion collation' do
164164
raw_response = eval(mock_response_with_spellcheck_collation)
165-
r = Blacklight::Solr::Response.new(raw_response, {})
165+
r = described_class.new(raw_response, {})
166166
expect(r.spelling.collation).to eq 'dell ultrasharp'
167167
end
168168
end
169169

170170
context "solr 5 spellcheck collation syntax" do
171171
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
172172
raw_response = eval(mock_response_with_spellcheck_collation_solr5)
173-
r = Blacklight::Solr::Response.new(raw_response, {})
173+
r = described_class.new(raw_response, {})
174174
expect(r.spelling.words).to include("dell")
175175
expect(r.spelling.words).to include("ultrasharp")
176176
end
177177

178178
it 'provides spelling suggestion collation' do
179179
raw_response = eval(mock_response_with_spellcheck_collation_solr5)
180-
r = Blacklight::Solr::Response.new(raw_response, {})
180+
r = described_class.new(raw_response, {})
181181
expect(r.spelling.collation).to eq 'dell ultrasharp'
182182
end
183183
end
184184

185185
context 'solr 6.5 spellcheck collation syntax' do
186186
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
187187
raw_response = eval(mock_response_with_spellcheck_collation_solr65)
188-
r = Blacklight::Solr::Response.new(raw_response, {})
188+
r = described_class.new(raw_response, {})
189189
expect(r.spelling.words).to include("dell")
190190
expect(r.spelling.words).to include("ultrasharp")
191191
end
192192
end
193193

194194
it "provides MoreLikeThis suggestions" do
195195
raw_response = eval(mock_response_with_more_like_this)
196-
r = Blacklight::Solr::Response.new(raw_response, {})
196+
r = described_class.new(raw_response, {})
197197
expect(r.more_like(double(id: '79930185'))).to have(2).items
198198
end
199199

200200
it "is empty when the response has no results" do
201-
r = Blacklight::Solr::Response.new({}, {})
201+
r = described_class.new({}, {})
202202
allow(r).to receive_messages(total: 0)
203203
expect(r).to be_empty
204204
end
205205

206206
describe "#export_formats" do
207207
it "collects the unique export formats for the current response" do
208-
r = Blacklight::Solr::Response.new({}, {})
208+
r = described_class.new({}, {})
209209
allow(r).to receive_messages(documents: [double(export_formats: { a: 1, b: 2 }), double(export_formats: { b: 1, c: 2 })])
210210
expect(r.export_formats).to include :a, :b
211211
end

spec/models/blacklight/suggest/response_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
describe '#initialize' do
4545
it 'creates a Blacklight::Suggest::Response' do
46-
expect(empty_response).to be_an Blacklight::Suggest::Response
46+
expect(empty_response).to be_an described_class
4747
end
4848
end
4949

spec/models/solr_document_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RSpec.describe SolrDocument, api: true do
44
describe "access methods" do
55
let(:solrdoc) do
6-
SolrDocument.new(id: '00282214', format: ['Book'], title_tsim: 'some-title')
6+
described_class.new(id: '00282214', format: ['Book'], title_tsim: 'some-title')
77
end
88

99
describe "#[]" do

0 commit comments

Comments
 (0)