rubocop-rspec 2.7.0 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/config/default.yml +144 -92
- data/lib/rubocop/cop/rspec/be_eq.rb +45 -0
- data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
- data/lib/rubocop/cop/rspec/be_nil.rb +74 -0
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +11 -7
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +3 -2
- data/lib/rubocop/cop/rspec/empty_example_group.rb +6 -6
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +3 -9
- data/lib/rubocop/cop/rspec/leading_subject.rb +3 -7
- data/lib/rubocop/cop/rspec/mixin/inside_example_group.rb +2 -2
- data/lib/rubocop/cop/rspec/subject_stub.rb +44 -18
- data/lib/rubocop/cop/rspec/verified_double_reference.rb +111 -0
- data/lib/rubocop/cop/rspec/yield.rb +1 -1
- data/lib/rubocop/cop/rspec_cops.rb +3 -0
- data/lib/rubocop/rspec/config_formatter.rb +3 -4
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop-rspec.rb +14 -9
- metadata +5 -2
data/config/default.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
RSpec:
|
3
3
|
Enabled: true
|
4
|
+
StyleGuideBaseURL: https://rspec.rubystyle.guide
|
4
5
|
Include: &1
|
5
6
|
- "**/*_spec.rb"
|
6
7
|
- "**/spec/**/*"
|
@@ -113,37 +114,56 @@ RSpec/AlignLeftLetBrace:
|
|
113
114
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
114
115
|
Enabled: false
|
115
116
|
VersionAdded: '1.16'
|
116
|
-
|
117
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
117
118
|
|
118
119
|
RSpec/AlignRightLetBrace:
|
119
120
|
Description: Checks that right braces for adjacent single line lets are aligned.
|
120
121
|
Enabled: false
|
121
122
|
VersionAdded: '1.16'
|
122
|
-
|
123
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
123
124
|
|
124
125
|
RSpec/AnyInstance:
|
125
126
|
Description: Check that instances are not being stubbed globally.
|
126
127
|
Enabled: true
|
127
128
|
VersionAdded: '1.4'
|
128
|
-
StyleGuide: https://
|
129
|
+
StyleGuide: https://rspec.rubystyle.guide/#any_instance_of
|
130
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
129
131
|
|
130
132
|
RSpec/AroundBlock:
|
131
133
|
Description: Checks that around blocks actually run the test.
|
132
134
|
Enabled: true
|
133
135
|
VersionAdded: '1.11'
|
134
|
-
|
136
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
135
137
|
|
136
138
|
RSpec/Be:
|
137
139
|
Description: Check for expectations where `be` is used without argument.
|
138
140
|
Enabled: true
|
139
141
|
VersionAdded: '1.25'
|
140
|
-
StyleGuide: https://
|
142
|
+
StyleGuide: https://rspec.rubystyle.guide/#be-matcher
|
143
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
144
|
+
|
145
|
+
RSpec/BeEq:
|
146
|
+
Description: Check for expectations where `be(...)` can replace `eq(...)`.
|
147
|
+
Enabled: pending
|
148
|
+
VersionAdded: 2.9.0
|
149
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
|
141
150
|
|
142
151
|
RSpec/BeEql:
|
143
152
|
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
144
153
|
Enabled: true
|
145
154
|
VersionAdded: '1.7'
|
146
|
-
|
155
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
156
|
+
|
157
|
+
RSpec/BeNil:
|
158
|
+
Description: Ensures a consistent style is used when matching `nil`.
|
159
|
+
Enabled: pending
|
160
|
+
EnforcedStyle: be_nil
|
161
|
+
SupportedStyles:
|
162
|
+
- be
|
163
|
+
- be_nil
|
164
|
+
VersionAdded: 2.9.0
|
165
|
+
VersionChanged: 2.10.0
|
166
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
|
147
167
|
|
148
168
|
RSpec/BeforeAfterAll:
|
149
169
|
Description: Check that before/after(:all) isn't being used.
|
@@ -153,13 +173,15 @@ RSpec/BeforeAfterAll:
|
|
153
173
|
- spec/rails_helper.rb
|
154
174
|
- spec/support/**/*.rb
|
155
175
|
VersionAdded: '1.12'
|
156
|
-
StyleGuide: https://
|
176
|
+
StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
|
177
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
157
178
|
|
158
179
|
RSpec/ContextMethod:
|
159
180
|
Description: "`context` should not be used for specifying methods."
|
160
181
|
Enabled: true
|
161
182
|
VersionAdded: '1.36'
|
162
|
-
StyleGuide: https://
|
183
|
+
StyleGuide: https://rspec.rubystyle.guide/#example-group-naming
|
184
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
163
185
|
|
164
186
|
RSpec/ContextWording:
|
165
187
|
Description: Checks that `context` docstring starts with an allowed prefix.
|
@@ -170,7 +192,8 @@ RSpec/ContextWording:
|
|
170
192
|
- without
|
171
193
|
VersionAdded: '1.20'
|
172
194
|
VersionChanged: 1.20.1
|
173
|
-
StyleGuide: https://
|
195
|
+
StyleGuide: https://rspec.rubystyle.guide/#context-descriptions
|
196
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
174
197
|
|
175
198
|
RSpec/DescribeClass:
|
176
199
|
Description: Check that the first argument to the top-level describe is a constant.
|
@@ -199,19 +222,19 @@ RSpec/DescribeClass:
|
|
199
222
|
- task
|
200
223
|
VersionAdded: '1.0'
|
201
224
|
VersionChanged: '2.7'
|
202
|
-
|
225
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
203
226
|
|
204
227
|
RSpec/DescribeMethod:
|
205
228
|
Description: Checks that the second argument to `describe` specifies a method.
|
206
229
|
Enabled: true
|
207
230
|
VersionAdded: '1.0'
|
208
|
-
|
231
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
209
232
|
|
210
233
|
RSpec/DescribeSymbol:
|
211
234
|
Description: Avoid describing symbols.
|
212
235
|
Enabled: true
|
213
236
|
VersionAdded: '1.15'
|
214
|
-
|
237
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
215
238
|
|
216
239
|
RSpec/DescribedClass:
|
217
240
|
Description: Checks that tests use `described_class`.
|
@@ -224,64 +247,69 @@ RSpec/DescribedClass:
|
|
224
247
|
SafeAutoCorrect: false
|
225
248
|
VersionAdded: '1.0'
|
226
249
|
VersionChanged: '1.11'
|
227
|
-
|
250
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
228
251
|
|
229
252
|
RSpec/DescribedClassModuleWrapping:
|
230
253
|
Description: Avoid opening modules and defining specs within them.
|
231
254
|
Enabled: false
|
232
255
|
VersionAdded: '1.37'
|
233
|
-
|
256
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
234
257
|
|
235
258
|
RSpec/Dialect:
|
236
259
|
Description: This cop enforces custom RSpec dialects.
|
237
260
|
Enabled: false
|
238
261
|
PreferredMethods: {}
|
239
262
|
VersionAdded: '1.33'
|
240
|
-
|
263
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
241
264
|
|
242
265
|
RSpec/EmptyExampleGroup:
|
243
266
|
Description: Checks if an example group does not include any tests.
|
244
267
|
Enabled: true
|
245
268
|
VersionAdded: '1.7'
|
246
269
|
VersionChanged: '2.0'
|
247
|
-
|
270
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
248
271
|
|
249
272
|
RSpec/EmptyHook:
|
250
273
|
Description: Checks for empty before and after hooks.
|
251
274
|
Enabled: true
|
252
275
|
VersionAdded: '1.39'
|
253
|
-
|
276
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
254
277
|
|
255
278
|
RSpec/EmptyLineAfterExample:
|
256
279
|
Description: Checks if there is an empty line after example blocks.
|
257
280
|
Enabled: true
|
258
281
|
AllowConsecutiveOneLiners: true
|
259
282
|
VersionAdded: '1.36'
|
260
|
-
StyleGuide: https://
|
283
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples
|
284
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
261
285
|
|
262
286
|
RSpec/EmptyLineAfterExampleGroup:
|
263
287
|
Description: Checks if there is an empty line after example group blocks.
|
264
288
|
Enabled: true
|
265
289
|
VersionAdded: '1.27'
|
266
|
-
StyleGuide: https://
|
290
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes
|
291
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
267
292
|
|
268
293
|
RSpec/EmptyLineAfterFinalLet:
|
269
294
|
Description: Checks if there is an empty line after the last let block.
|
270
295
|
Enabled: true
|
271
296
|
VersionAdded: '1.14'
|
272
|
-
StyleGuide: https://
|
297
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
298
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
273
299
|
|
274
300
|
RSpec/EmptyLineAfterHook:
|
275
301
|
Description: Checks if there is an empty line after hook blocks.
|
276
302
|
Enabled: true
|
277
303
|
VersionAdded: '1.27'
|
278
|
-
StyleGuide: https://
|
304
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
305
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
279
306
|
|
280
307
|
RSpec/EmptyLineAfterSubject:
|
281
308
|
Description: Checks if there is an empty line after subject block.
|
282
309
|
Enabled: true
|
283
310
|
VersionAdded: '1.14'
|
284
|
-
StyleGuide: https://
|
311
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
312
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
285
313
|
|
286
314
|
RSpec/ExampleLength:
|
287
315
|
Description: Checks for long examples.
|
@@ -290,7 +318,7 @@ RSpec/ExampleLength:
|
|
290
318
|
CountAsOne: []
|
291
319
|
VersionAdded: '1.5'
|
292
320
|
VersionChanged: '2.3'
|
293
|
-
|
321
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
294
322
|
|
295
323
|
RSpec/ExampleWithoutDescription:
|
296
324
|
Description: Checks for examples without a description.
|
@@ -301,13 +329,13 @@ RSpec/ExampleWithoutDescription:
|
|
301
329
|
- single_line_only
|
302
330
|
- disallow
|
303
331
|
VersionAdded: '1.22'
|
304
|
-
|
332
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
305
333
|
|
306
334
|
RSpec/ExcessiveDocstringSpacing:
|
307
335
|
Description: Checks for excessive whitespace in example descriptions.
|
308
336
|
Enabled: pending
|
309
337
|
VersionAdded: '2.5'
|
310
|
-
|
338
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
311
339
|
|
312
340
|
RSpec/ExampleWording:
|
313
341
|
Description: Checks for common mistakes in example descriptions.
|
@@ -320,7 +348,8 @@ RSpec/ExampleWording:
|
|
320
348
|
IgnoredWords: []
|
321
349
|
VersionAdded: '1.0'
|
322
350
|
VersionChanged: '1.2'
|
323
|
-
StyleGuide: https://
|
351
|
+
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
|
352
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
324
353
|
|
325
354
|
RSpec/ExpectActual:
|
326
355
|
Description: Checks for `expect(...)` calls containing literal values.
|
@@ -328,7 +357,7 @@ RSpec/ExpectActual:
|
|
328
357
|
Exclude:
|
329
358
|
- spec/routing/**/*
|
330
359
|
VersionAdded: '1.7'
|
331
|
-
|
360
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
332
361
|
|
333
362
|
RSpec/ExpectChange:
|
334
363
|
Description: Checks for consistent style of change matcher.
|
@@ -340,19 +369,19 @@ RSpec/ExpectChange:
|
|
340
369
|
SafeAutoCorrect: false
|
341
370
|
VersionAdded: '1.22'
|
342
371
|
VersionChanged: '2.5'
|
343
|
-
|
372
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
344
373
|
|
345
374
|
RSpec/ExpectInHook:
|
346
375
|
Description: Do not use `expect` in hooks such as `before`.
|
347
376
|
Enabled: true
|
348
377
|
VersionAdded: '1.16'
|
349
|
-
|
378
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
350
379
|
|
351
380
|
RSpec/ExpectOutput:
|
352
381
|
Description: Checks for opportunities to use `expect { ... }.to output`.
|
353
382
|
Enabled: true
|
354
383
|
VersionAdded: '1.10'
|
355
|
-
|
384
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
356
385
|
|
357
386
|
RSpec/FilePath:
|
358
387
|
Description: Checks that spec file paths are consistent and well-formed.
|
@@ -367,14 +396,14 @@ RSpec/FilePath:
|
|
367
396
|
SpecSuffixOnly: false
|
368
397
|
VersionAdded: '1.2'
|
369
398
|
VersionChanged: '1.40'
|
370
|
-
|
399
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
371
400
|
|
372
401
|
RSpec/Focus:
|
373
402
|
Description: Checks if examples are focused.
|
374
403
|
Enabled: true
|
375
404
|
VersionAdded: '1.5'
|
376
405
|
VersionChanged: '2.1'
|
377
|
-
|
406
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
378
407
|
|
379
408
|
RSpec/HookArgument:
|
380
409
|
Description: Checks the arguments passed to `before`, `around`, and `after`.
|
@@ -385,25 +414,27 @@ RSpec/HookArgument:
|
|
385
414
|
- each
|
386
415
|
- example
|
387
416
|
VersionAdded: '1.7'
|
388
|
-
StyleGuide: https://
|
417
|
+
StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach
|
418
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
389
419
|
|
390
420
|
RSpec/HooksBeforeExamples:
|
391
421
|
Description: Checks for before/around/after hooks that come after an example.
|
392
422
|
Enabled: true
|
393
423
|
VersionAdded: '1.29'
|
394
|
-
|
424
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
395
425
|
|
396
426
|
RSpec/IdenticalEqualityAssertion:
|
397
427
|
Description: Checks for equality assertions with identical expressions on both sides.
|
398
428
|
Enabled: pending
|
399
429
|
VersionAdded: '2.4'
|
400
|
-
|
430
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
|
401
431
|
|
402
432
|
RSpec/ImplicitBlockExpectation:
|
403
433
|
Description: Check that implicit block expectation syntax is not used.
|
404
434
|
Enabled: true
|
405
435
|
VersionAdded: '1.35'
|
406
|
-
StyleGuide: https://
|
436
|
+
StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations
|
437
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
407
438
|
|
408
439
|
RSpec/ImplicitExpect:
|
409
440
|
Description: Check that a consistent implicit expectation style is used.
|
@@ -413,7 +444,8 @@ RSpec/ImplicitExpect:
|
|
413
444
|
- is_expected
|
414
445
|
- should
|
415
446
|
VersionAdded: '1.8'
|
416
|
-
StyleGuide: https://
|
447
|
+
StyleGuide: https://rspec.rubystyle.guide/#use-expect
|
448
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
417
449
|
|
418
450
|
RSpec/ImplicitSubject:
|
419
451
|
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
@@ -425,13 +457,13 @@ RSpec/ImplicitSubject:
|
|
425
457
|
- disallow
|
426
458
|
VersionAdded: '1.29'
|
427
459
|
VersionChanged: '1.30'
|
428
|
-
|
460
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
429
461
|
|
430
462
|
RSpec/InstanceSpy:
|
431
463
|
Description: Checks for `instance_double` used with `have_received`.
|
432
464
|
Enabled: true
|
433
465
|
VersionAdded: '1.12'
|
434
|
-
|
466
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
435
467
|
|
436
468
|
RSpec/InstanceVariable:
|
437
469
|
Description: Checks for instance variable usage in specs.
|
@@ -439,7 +471,8 @@ RSpec/InstanceVariable:
|
|
439
471
|
AssignmentOnly: false
|
440
472
|
VersionAdded: '1.0'
|
441
473
|
VersionChanged: '1.7'
|
442
|
-
StyleGuide: https://
|
474
|
+
StyleGuide: https://rspec.rubystyle.guide/#instance-variables
|
475
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
443
476
|
|
444
477
|
RSpec/ItBehavesLike:
|
445
478
|
Description: Checks that only one `it_behaves_like` style is used.
|
@@ -449,45 +482,47 @@ RSpec/ItBehavesLike:
|
|
449
482
|
- it_behaves_like
|
450
483
|
- it_should_behave_like
|
451
484
|
VersionAdded: '1.13'
|
452
|
-
|
485
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
453
486
|
|
454
487
|
RSpec/IteratedExpectation:
|
455
488
|
Description: Check that `all` matcher is used instead of iterating over an array.
|
456
489
|
Enabled: true
|
457
490
|
VersionAdded: '1.14'
|
458
|
-
|
491
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
459
492
|
|
460
493
|
RSpec/LeadingSubject:
|
461
494
|
Description: Enforce that subject is the first definition in the test.
|
462
495
|
Enabled: true
|
463
496
|
VersionAdded: '1.7'
|
464
497
|
VersionChanged: '1.14'
|
465
|
-
StyleGuide: https://
|
498
|
+
StyleGuide: https://rspec.rubystyle.guide/#leading-subject
|
499
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
466
500
|
|
467
501
|
RSpec/LeakyConstantDeclaration:
|
468
502
|
Description: Checks that no class, module, or constant is declared.
|
469
503
|
Enabled: true
|
470
504
|
VersionAdded: '1.35'
|
471
|
-
StyleGuide: https://
|
505
|
+
StyleGuide: https://rspec.rubystyle.guide/#declare-constants
|
506
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
472
507
|
|
473
508
|
RSpec/LetBeforeExamples:
|
474
509
|
Description: Checks for `let` definitions that come after an example.
|
475
510
|
Enabled: true
|
476
511
|
VersionAdded: '1.16'
|
477
512
|
VersionChanged: '1.22'
|
478
|
-
|
513
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
479
514
|
|
480
515
|
RSpec/LetSetup:
|
481
516
|
Description: Checks unreferenced `let!` calls being used for test setup.
|
482
517
|
Enabled: true
|
483
518
|
VersionAdded: '1.7'
|
484
|
-
|
519
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
485
520
|
|
486
521
|
RSpec/MessageChain:
|
487
522
|
Description: Check that chains of messages are not being stubbed.
|
488
523
|
Enabled: true
|
489
524
|
VersionAdded: '1.7'
|
490
|
-
|
525
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
491
526
|
|
492
527
|
RSpec/MessageExpectation:
|
493
528
|
Description: Checks for consistent message expectation style.
|
@@ -498,7 +533,7 @@ RSpec/MessageExpectation:
|
|
498
533
|
- expect
|
499
534
|
VersionAdded: '1.7'
|
500
535
|
VersionChanged: '1.8'
|
501
|
-
|
536
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
502
537
|
|
503
538
|
RSpec/MessageSpies:
|
504
539
|
Description: Checks that message expectations are set using spies.
|
@@ -508,19 +543,19 @@ RSpec/MessageSpies:
|
|
508
543
|
- have_received
|
509
544
|
- receive
|
510
545
|
VersionAdded: '1.9'
|
511
|
-
|
546
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
512
547
|
|
513
548
|
RSpec/MissingExampleGroupArgument:
|
514
549
|
Description: Checks that the first argument to an example group is not empty.
|
515
550
|
Enabled: true
|
516
551
|
VersionAdded: '1.28'
|
517
|
-
|
552
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
518
553
|
|
519
554
|
RSpec/MultipleDescribes:
|
520
555
|
Description: Checks for multiple top-level example groups.
|
521
556
|
Enabled: true
|
522
557
|
VersionAdded: '1.0'
|
523
|
-
|
558
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
524
559
|
|
525
560
|
RSpec/MultipleExpectations:
|
526
561
|
Description: Checks if examples contain too many `expect` calls.
|
@@ -528,7 +563,8 @@ RSpec/MultipleExpectations:
|
|
528
563
|
Max: 1
|
529
564
|
VersionAdded: '1.7'
|
530
565
|
VersionChanged: '1.21'
|
531
|
-
StyleGuide: https://
|
566
|
+
StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example
|
567
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
532
568
|
|
533
569
|
RSpec/MultipleMemoizedHelpers:
|
534
570
|
Description: Checks if example groups contain too many `let` and `subject` calls.
|
@@ -536,20 +572,22 @@ RSpec/MultipleMemoizedHelpers:
|
|
536
572
|
AllowSubject: true
|
537
573
|
Max: 5
|
538
574
|
VersionAdded: '1.43'
|
539
|
-
StyleGuide: https://
|
575
|
+
StyleGuide: https://rspec.rubystyle.guide/#let-blocks
|
576
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
|
540
577
|
|
541
578
|
RSpec/MultipleSubjects:
|
542
579
|
Description: Checks if an example group defines `subject` multiple times.
|
543
580
|
Enabled: true
|
544
581
|
VersionAdded: '1.16'
|
545
|
-
|
582
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
546
583
|
|
547
584
|
RSpec/NamedSubject:
|
548
585
|
Description: Checks for explicitly referenced test subjects.
|
549
586
|
Enabled: true
|
550
587
|
IgnoreSharedExamples: true
|
551
588
|
VersionAdded: 1.5.3
|
552
|
-
StyleGuide: https://
|
589
|
+
StyleGuide: https://rspec.rubystyle.guide/#use-subject
|
590
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
553
591
|
|
554
592
|
RSpec/NestedGroups:
|
555
593
|
Description: Checks for nested example groups.
|
@@ -557,7 +595,7 @@ RSpec/NestedGroups:
|
|
557
595
|
Max: 3
|
558
596
|
VersionAdded: '1.7'
|
559
597
|
VersionChanged: '1.10'
|
560
|
-
|
598
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
561
599
|
|
562
600
|
RSpec/NotToNot:
|
563
601
|
Description: Checks for consistent method usage for negating expectations.
|
@@ -567,19 +605,19 @@ RSpec/NotToNot:
|
|
567
605
|
- not_to
|
568
606
|
- to_not
|
569
607
|
VersionAdded: '1.4'
|
570
|
-
|
608
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
571
609
|
|
572
610
|
RSpec/OverwritingSetup:
|
573
611
|
Description: Checks if there is a let/subject that overwrites an existing one.
|
574
612
|
Enabled: true
|
575
613
|
VersionAdded: '1.14'
|
576
|
-
|
614
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
577
615
|
|
578
616
|
RSpec/Pending:
|
579
617
|
Description: Checks for any pending or skipped examples.
|
580
618
|
Enabled: false
|
581
619
|
VersionAdded: '1.25'
|
582
|
-
|
620
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
583
621
|
|
584
622
|
RSpec/PredicateMatcher:
|
585
623
|
Description: Prefer using predicate matcher over using predicate method directly.
|
@@ -592,49 +630,50 @@ RSpec/PredicateMatcher:
|
|
592
630
|
- explicit
|
593
631
|
SafeAutoCorrect: false
|
594
632
|
VersionAdded: '1.16'
|
595
|
-
StyleGuide: https://
|
633
|
+
StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers
|
634
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
596
635
|
|
597
636
|
RSpec/ReceiveCounts:
|
598
637
|
Description: Check for `once` and `twice` receive counts matchers usage.
|
599
638
|
Enabled: true
|
600
639
|
VersionAdded: '1.26'
|
601
|
-
|
640
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
602
641
|
|
603
642
|
RSpec/ReceiveNever:
|
604
643
|
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
605
644
|
Enabled: true
|
606
645
|
VersionAdded: '1.28'
|
607
|
-
|
646
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
608
647
|
|
609
648
|
RSpec/RepeatedDescription:
|
610
649
|
Description: Check for repeated description strings in example groups.
|
611
650
|
Enabled: true
|
612
651
|
VersionAdded: '1.9'
|
613
|
-
|
652
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
614
653
|
|
615
654
|
RSpec/RepeatedExample:
|
616
655
|
Description: Check for repeated examples within example groups.
|
617
656
|
Enabled: true
|
618
657
|
VersionAdded: '1.10'
|
619
|
-
|
658
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
620
659
|
|
621
660
|
RSpec/RepeatedExampleGroupBody:
|
622
661
|
Description: Check for repeated describe and context block body.
|
623
662
|
Enabled: true
|
624
663
|
VersionAdded: '1.38'
|
625
|
-
|
664
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
626
665
|
|
627
666
|
RSpec/RepeatedExampleGroupDescription:
|
628
667
|
Description: Check for repeated example group descriptions.
|
629
668
|
Enabled: true
|
630
669
|
VersionAdded: '1.38'
|
631
|
-
|
670
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
632
671
|
|
633
672
|
RSpec/RepeatedIncludeExample:
|
634
673
|
Description: Check for repeated include of shared examples.
|
635
674
|
Enabled: true
|
636
675
|
VersionAdded: '1.44'
|
637
|
-
|
676
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
|
638
677
|
|
639
678
|
RSpec/ReturnFromStub:
|
640
679
|
Description: Checks for consistent style of stub's return setting.
|
@@ -645,63 +684,65 @@ RSpec/ReturnFromStub:
|
|
645
684
|
- block
|
646
685
|
VersionAdded: '1.16'
|
647
686
|
VersionChanged: '1.22'
|
648
|
-
|
687
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
649
688
|
|
650
689
|
RSpec/ScatteredLet:
|
651
690
|
Description: Checks for let scattered across the example group.
|
652
691
|
Enabled: true
|
653
692
|
VersionAdded: '1.14'
|
654
693
|
VersionChanged: '1.39'
|
655
|
-
|
694
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
656
695
|
|
657
696
|
RSpec/ScatteredSetup:
|
658
697
|
Description: Checks for setup scattered across multiple hooks in an example group.
|
659
698
|
Enabled: true
|
660
699
|
VersionAdded: '1.10'
|
661
|
-
|
700
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
662
701
|
|
663
702
|
RSpec/SharedContext:
|
664
703
|
Description: Checks for proper shared_context and shared_examples usage.
|
665
704
|
Enabled: true
|
666
705
|
VersionAdded: '1.13'
|
667
|
-
|
706
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
668
707
|
|
669
708
|
RSpec/SharedExamples:
|
670
709
|
Description: Enforces use of string to titleize shared examples.
|
671
710
|
Enabled: true
|
672
711
|
VersionAdded: '1.25'
|
673
|
-
|
712
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
674
713
|
|
675
714
|
RSpec/SingleArgumentMessageChain:
|
676
715
|
Description: Checks that chains of messages contain more than one element.
|
677
716
|
Enabled: true
|
678
717
|
VersionAdded: '1.9'
|
679
718
|
VersionChanged: '1.10'
|
680
|
-
|
719
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
681
720
|
|
682
721
|
RSpec/StubbedMock:
|
683
722
|
Description: Checks that message expectations do not have a configured response.
|
684
723
|
Enabled: true
|
685
724
|
VersionAdded: '1.44'
|
686
|
-
|
725
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
687
726
|
|
688
727
|
RSpec/SubjectDeclaration:
|
689
728
|
Description: Ensure that subject is defined using subject helper.
|
690
729
|
Enabled: pending
|
691
730
|
VersionAdded: '2.5'
|
692
|
-
|
731
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
|
693
732
|
|
694
733
|
RSpec/SubjectStub:
|
695
734
|
Description: Checks for stubbed test subjects.
|
696
735
|
Enabled: true
|
697
736
|
VersionAdded: '1.7'
|
698
|
-
|
737
|
+
VersionChanged: '2.8'
|
738
|
+
StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject
|
739
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
699
740
|
|
700
741
|
RSpec/UnspecifiedException:
|
701
742
|
Description: Checks for a specified error in checking raised errors.
|
702
743
|
Enabled: true
|
703
744
|
VersionAdded: '1.30'
|
704
|
-
|
745
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
705
746
|
|
706
747
|
RSpec/VariableDefinition:
|
707
748
|
Description: Checks that memoized helpers names are symbols or strings.
|
@@ -711,7 +752,7 @@ RSpec/VariableDefinition:
|
|
711
752
|
- symbols
|
712
753
|
- strings
|
713
754
|
VersionAdded: '1.40'
|
714
|
-
|
755
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
715
756
|
|
716
757
|
RSpec/VariableName:
|
717
758
|
Description: Checks that memoized helper names use the configured style.
|
@@ -723,7 +764,17 @@ RSpec/VariableName:
|
|
723
764
|
IgnoredPatterns: []
|
724
765
|
VersionAdded: '1.40'
|
725
766
|
VersionChanged: '1.43'
|
726
|
-
|
767
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
768
|
+
|
769
|
+
RSpec/VerifiedDoubleReference:
|
770
|
+
Description: Checks for consistent verified double reference style.
|
771
|
+
Enabled: pending
|
772
|
+
EnforcedStyle: constant
|
773
|
+
SupportedStyles:
|
774
|
+
- constant
|
775
|
+
- string
|
776
|
+
VersionAdded: 2.10.0
|
777
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference
|
727
778
|
|
728
779
|
RSpec/VerifiedDoubles:
|
729
780
|
Description: Prefer using verifying doubles over normal doubles.
|
@@ -732,19 +783,20 @@ RSpec/VerifiedDoubles:
|
|
732
783
|
IgnoreSymbolicNames: false
|
733
784
|
VersionAdded: 1.2.1
|
734
785
|
VersionChanged: '1.5'
|
735
|
-
StyleGuide: https://
|
786
|
+
StyleGuide: https://rspec.rubystyle.guide/#doubles
|
787
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
736
788
|
|
737
789
|
RSpec/VoidExpect:
|
738
790
|
Description: This cop checks void `expect()`.
|
739
791
|
Enabled: true
|
740
792
|
VersionAdded: '1.16'
|
741
|
-
|
793
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
742
794
|
|
743
795
|
RSpec/Yield:
|
744
796
|
Description: This cop checks for calling a block within a stub.
|
745
797
|
Enabled: true
|
746
798
|
VersionAdded: '1.32'
|
747
|
-
|
799
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
748
800
|
|
749
801
|
RSpec/Capybara:
|
750
802
|
Enabled: true
|
@@ -756,7 +808,7 @@ RSpec/Capybara/CurrentPathExpectation:
|
|
756
808
|
Enabled: true
|
757
809
|
VersionAdded: '1.18'
|
758
810
|
VersionChanged: '2.0'
|
759
|
-
|
811
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
760
812
|
|
761
813
|
RSpec/Capybara/FeatureMethods:
|
762
814
|
Description: Checks for consistent method usage in feature specs.
|
@@ -764,14 +816,14 @@ RSpec/Capybara/FeatureMethods:
|
|
764
816
|
EnabledMethods: []
|
765
817
|
VersionAdded: '1.17'
|
766
818
|
VersionChanged: '2.0'
|
767
|
-
|
819
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
768
820
|
|
769
821
|
RSpec/Capybara/VisibilityMatcher:
|
770
|
-
Description: Checks for boolean visibility in
|
822
|
+
Description: Checks for boolean visibility in Capybara finders.
|
771
823
|
Enabled: true
|
772
824
|
VersionAdded: '1.39'
|
773
825
|
VersionChanged: '2.0'
|
774
|
-
|
826
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
|
775
827
|
|
776
828
|
RSpec/FactoryBot:
|
777
829
|
Enabled: true
|
@@ -787,7 +839,7 @@ RSpec/FactoryBot/AttributeDefinedStatically:
|
|
787
839
|
- features/support/factories/**/*.rb
|
788
840
|
VersionAdded: '1.28'
|
789
841
|
VersionChanged: '2.0'
|
790
|
-
|
842
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
791
843
|
|
792
844
|
RSpec/FactoryBot/CreateList:
|
793
845
|
Description: Checks for create_list usage.
|
@@ -804,7 +856,7 @@ RSpec/FactoryBot/CreateList:
|
|
804
856
|
- n_times
|
805
857
|
VersionAdded: '1.25'
|
806
858
|
VersionChanged: '2.0'
|
807
|
-
|
859
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
808
860
|
|
809
861
|
RSpec/FactoryBot/FactoryClassName:
|
810
862
|
Description: Use string value when setting the class attribute explicitly.
|
@@ -815,14 +867,14 @@ RSpec/FactoryBot/FactoryClassName:
|
|
815
867
|
- features/support/factories/**/*.rb
|
816
868
|
VersionAdded: '1.37'
|
817
869
|
VersionChanged: '2.0'
|
818
|
-
|
870
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
819
871
|
|
820
872
|
RSpec/FactoryBot/SyntaxMethods:
|
821
873
|
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
822
874
|
Enabled: pending
|
823
875
|
SafeAutoCorrect: false
|
824
876
|
VersionAdded: '2.7'
|
825
|
-
|
877
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
|
826
878
|
|
827
879
|
RSpec/Rails:
|
828
880
|
Enabled: true
|
@@ -833,7 +885,7 @@ RSpec/Rails/AvoidSetupHook:
|
|
833
885
|
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
|
834
886
|
Enabled: pending
|
835
887
|
VersionAdded: '2.4'
|
836
|
-
|
888
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
|
837
889
|
|
838
890
|
RSpec/Rails/HttpStatus:
|
839
891
|
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
@@ -844,4 +896,4 @@ RSpec/Rails/HttpStatus:
|
|
844
896
|
- symbolic
|
845
897
|
VersionAdded: '1.23'
|
846
898
|
VersionChanged: '2.0'
|
847
|
-
|
899
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|