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