rubocop-rspec 2.21.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +147 -9
  3. data/README.md +2 -2
  4. data/config/default.yml +159 -244
  5. data/config/obsoletion.yml +24 -0
  6. data/lib/rubocop/cop/rspec/around_block.rb +3 -3
  7. data/lib/rubocop/cop/rspec/base.rb +0 -1
  8. data/lib/rubocop/cop/rspec/be.rb +1 -1
  9. data/lib/rubocop/cop/rspec/be_empty.rb +1 -0
  10. data/lib/rubocop/cop/rspec/be_eq.rb +1 -1
  11. data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
  12. data/lib/rubocop/cop/rspec/be_nil.rb +2 -2
  13. data/lib/rubocop/cop/rspec/before_after_all.rb +7 -13
  14. data/lib/rubocop/cop/rspec/change_by_zero.rb +30 -4
  15. data/lib/rubocop/cop/rspec/context_method.rb +2 -2
  16. data/lib/rubocop/cop/rspec/context_wording.rb +1 -1
  17. data/lib/rubocop/cop/rspec/describe_symbol.rb +1 -1
  18. data/lib/rubocop/cop/rspec/described_class.rb +33 -11
  19. data/lib/rubocop/cop/rspec/dialect.rb +13 -0
  20. data/lib/rubocop/cop/rspec/duplicated_metadata.rb +1 -1
  21. data/lib/rubocop/cop/rspec/empty_example_group.rb +4 -1
  22. data/lib/rubocop/cop/rspec/empty_hook.rb +1 -1
  23. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +2 -2
  24. data/lib/rubocop/cop/rspec/empty_metadata.rb +46 -0
  25. data/lib/rubocop/cop/rspec/empty_output.rb +47 -0
  26. data/lib/rubocop/cop/rspec/eq.rb +47 -0
  27. data/lib/rubocop/cop/rspec/example_length.rb +11 -5
  28. data/lib/rubocop/cop/rspec/example_without_description.rb +11 -2
  29. data/lib/rubocop/cop/rspec/example_wording.rb +11 -2
  30. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +14 -5
  31. data/lib/rubocop/cop/rspec/expect_actual.rb +17 -14
  32. data/lib/rubocop/cop/rspec/expect_change.rb +2 -2
  33. data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
  34. data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
  35. data/lib/rubocop/cop/rspec/expect_output.rb +1 -4
  36. data/lib/rubocop/cop/rspec/focus.rb +17 -2
  37. data/lib/rubocop/cop/rspec/hook_argument.rb +2 -2
  38. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -1
  39. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +2 -2
  40. data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -1
  41. data/lib/rubocop/cop/rspec/implicit_subject.rb +2 -2
  42. data/lib/rubocop/cop/rspec/indexed_let.rb +32 -1
  43. data/lib/rubocop/cop/rspec/instance_spy.rb +2 -2
  44. data/lib/rubocop/cop/rspec/instance_variable.rb +4 -4
  45. data/lib/rubocop/cop/rspec/is_expected_specify.rb +45 -0
  46. data/lib/rubocop/cop/rspec/iterated_expectation.rb +3 -3
  47. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +2 -2
  48. data/lib/rubocop/cop/rspec/let_before_examples.rb +5 -1
  49. data/lib/rubocop/cop/rspec/let_setup.rb +1 -1
  50. data/lib/rubocop/cop/rspec/message_expectation.rb +1 -2
  51. data/lib/rubocop/cop/rspec/message_spies.rb +0 -2
  52. data/lib/rubocop/cop/rspec/metadata_style.rb +202 -0
  53. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  54. data/lib/rubocop/cop/rspec/mixin/file_help.rb +14 -0
  55. data/lib/rubocop/cop/rspec/mixin/metadata.rb +21 -7
  56. data/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb +2 -2
  57. data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
  58. data/lib/rubocop/cop/rspec/multiple_expectations.rb +16 -11
  59. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +2 -4
  60. data/lib/rubocop/cop/rspec/named_subject.rb +6 -3
  61. data/lib/rubocop/cop/rspec/pending.rb +12 -2
  62. data/lib/rubocop/cop/rspec/pending_without_reason.rb +1 -1
  63. data/lib/rubocop/cop/rspec/predicate_matcher.rb +10 -10
  64. data/lib/rubocop/cop/rspec/receive_counts.rb +1 -1
  65. data/lib/rubocop/cop/rspec/receive_messages.rb +161 -0
  66. data/lib/rubocop/cop/rspec/redundant_predicate_matcher.rb +67 -0
  67. data/lib/rubocop/cop/rspec/remove_const.rb +39 -0
  68. data/lib/rubocop/cop/rspec/repeated_example.rb +6 -6
  69. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +1 -1
  70. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +2 -2
  71. data/lib/rubocop/cop/rspec/repeated_include_example.rb +1 -1
  72. data/lib/rubocop/cop/rspec/repeated_subject_call.rb +125 -0
  73. data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
  74. data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
  75. data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
  76. data/lib/rubocop/cop/rspec/shared_examples.rb +66 -20
  77. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +2 -3
  78. data/lib/rubocop/cop/rspec/sort_metadata.rb +3 -2
  79. data/lib/rubocop/cop/rspec/spec_file_path_format.rb +133 -0
  80. data/lib/rubocop/cop/rspec/spec_file_path_suffix.rb +40 -0
  81. data/lib/rubocop/cop/rspec/stubbed_mock.rb +4 -2
  82. data/lib/rubocop/cop/rspec/subject_stub.rb +6 -6
  83. data/lib/rubocop/cop/rspec/undescriptive_literals_description.rb +69 -0
  84. data/lib/rubocop/cop/rspec/unspecified_exception.rb +2 -2
  85. data/lib/rubocop/cop/rspec/variable_definition.rb +4 -4
  86. data/lib/rubocop/cop/rspec/verified_double_reference.rb +6 -6
  87. data/lib/rubocop/cop/rspec/verified_doubles.rb +2 -2
  88. data/lib/rubocop/cop/rspec/void_expect.rb +4 -3
  89. data/lib/rubocop/cop/rspec_cops.rb +14 -28
  90. data/lib/rubocop/rspec/concept.rb +0 -1
  91. data/lib/rubocop/rspec/config_formatter.rb +1 -11
  92. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  93. data/lib/rubocop/rspec/language.rb +8 -9
  94. data/lib/rubocop/rspec/node.rb +1 -1
  95. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +1 -1
  96. data/lib/rubocop/rspec/version.rb +1 -1
  97. data/lib/rubocop/rspec/wording.rb +8 -0
  98. data/lib/rubocop-rspec.rb +2 -16
  99. metadata +27 -49
  100. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +0 -39
  101. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +0 -104
  102. data/lib/rubocop/cop/rspec/capybara/match_style.rb +0 -38
  103. data/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +0 -33
  104. data/lib/rubocop/cop/rspec/capybara/specific_actions.rb +0 -29
  105. data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +0 -24
  106. data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +0 -35
  107. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -36
  108. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +0 -128
  109. data/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +0 -117
  110. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +0 -260
  111. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +0 -56
  112. data/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +0 -74
  113. data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +0 -89
  114. data/lib/rubocop/cop/rspec/file_path.rb +0 -173
  115. data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +0 -43
  116. data/lib/rubocop/cop/rspec/rails/have_http_status.rb +0 -55
  117. data/lib/rubocop/cop/rspec/rails/http_status.rb +0 -203
  118. data/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb +0 -145
  119. data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +0 -60
  120. data/lib/rubocop/cop/rspec/rails/travel_around.rb +0 -92
  121. data/lib/rubocop/rspec/factory_bot/language.rb +0 -37
  122. data/lib/rubocop/rspec/factory_bot.rb +0 -64
  123. data/lib/rubocop/rspec/language/node_pattern.rb +0 -48
data/config/default.yml CHANGED
@@ -3,10 +3,10 @@ RSpec:
3
3
  Enabled: true
4
4
  StyleGuideBaseURL: https://rspec.rubystyle.guide
5
5
  DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec
6
- Include: &1
6
+ Include:
7
7
  - "**/*_spec.rb"
8
8
  - "**/spec/**/*"
9
- Language: &2
9
+ Language:
10
10
  inherit_mode:
11
11
  merge:
12
12
  - Expectations
@@ -146,13 +146,15 @@ RSpec/Be:
146
146
 
147
147
  RSpec/BeEmpty:
148
148
  Description: Prefer using `be_empty` when checking for an empty array.
149
- Enabled: pending
149
+ Enabled: true
150
+ AutoCorrect: contextual
150
151
  VersionAdded: '2.20'
152
+ VersionChanged: '2.31'
151
153
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEmpty
152
154
 
153
155
  RSpec/BeEq:
154
156
  Description: Check for expectations where `be(...)` can replace `eq(...)`.
155
- Enabled: pending
157
+ Enabled: true
156
158
  Safe: false
157
159
  VersionAdded: 2.9.0
158
160
  VersionChanged: '2.16'
@@ -168,7 +170,7 @@ RSpec/BeEql:
168
170
 
169
171
  RSpec/BeNil:
170
172
  Description: Ensures a consistent style is used when matching `nil`.
171
- Enabled: pending
173
+ Enabled: true
172
174
  EnforcedStyle: be_nil
173
175
  SupportedStyles:
174
176
  - be
@@ -178,19 +180,20 @@ RSpec/BeNil:
178
180
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
179
181
 
180
182
  RSpec/BeforeAfterAll:
181
- Description: Check that before/after(:all) isn't being used.
183
+ Description: Check that before/after(:all/:context) isn't being used.
182
184
  Enabled: true
183
185
  Exclude:
184
- - spec/spec_helper.rb
185
- - spec/rails_helper.rb
186
- - spec/support/**/*.rb
186
+ - "**/spec/spec_helper.rb"
187
+ - "**/spec/rails_helper.rb"
188
+ - "**/spec/support/**/*.rb"
187
189
  VersionAdded: '1.12'
190
+ VersionChanged: '2.23'
188
191
  StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
189
192
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
190
193
 
191
194
  RSpec/ChangeByZero:
192
195
  Description: Prefer negated matchers over `to change.by(0)`.
193
- Enabled: pending
196
+ Enabled: true
194
197
  VersionAdded: '2.11'
195
198
  VersionChanged: '2.14'
196
199
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero
@@ -199,7 +202,7 @@ RSpec/ChangeByZero:
199
202
  RSpec/ClassCheck:
200
203
  Description: Enforces consistent use of `be_a` or `be_kind_of`.
201
204
  StyleGuide: "#is-a-vs-kind-of"
202
- Enabled: pending
205
+ Enabled: true
203
206
  VersionAdded: '2.13'
204
207
  EnforcedStyle: be_a
205
208
  SupportedStyles:
@@ -209,7 +212,7 @@ RSpec/ClassCheck:
209
212
 
210
213
  RSpec/ContainExactly:
211
214
  Description: Checks where `contain_exactly` is used.
212
- Enabled: pending
215
+ Enabled: true
213
216
  VersionAdded: '2.19'
214
217
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContainExactly
215
218
 
@@ -282,9 +285,10 @@ RSpec/DescribedClass:
282
285
  SupportedStyles:
283
286
  - described_class
284
287
  - explicit
288
+ OnlyStaticConstants: true
285
289
  SafeAutoCorrect: false
286
290
  VersionAdded: '1.0'
287
- VersionChanged: '1.11'
291
+ VersionChanged: '2.27'
288
292
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
289
293
 
290
294
  RSpec/DescribedClassModuleWrapping:
@@ -302,22 +306,25 @@ RSpec/Dialect:
302
306
 
303
307
  RSpec/DuplicatedMetadata:
304
308
  Description: Avoid duplicated metadata.
305
- Enabled: pending
309
+ Enabled: true
306
310
  VersionAdded: '2.16'
307
311
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
308
312
 
309
313
  RSpec/EmptyExampleGroup:
310
314
  Description: Checks if an example group does not include any tests.
311
315
  Enabled: true
316
+ AutoCorrect: contextual
312
317
  SafeAutoCorrect: false
313
318
  VersionAdded: '1.7'
314
- VersionChanged: '2.13'
319
+ VersionChanged: '2.31'
315
320
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
316
321
 
317
322
  RSpec/EmptyHook:
318
323
  Description: Checks for empty before and after hooks.
319
324
  Enabled: true
325
+ AutoCorrect: contextual
320
326
  VersionAdded: '1.39'
327
+ VersionChanged: '2.31'
321
328
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
322
329
 
323
330
  RSpec/EmptyLineAfterExample:
@@ -358,6 +365,26 @@ RSpec/EmptyLineAfterSubject:
358
365
  StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
359
366
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
360
367
 
368
+ RSpec/EmptyMetadata:
369
+ Description: Avoid empty metadata hash.
370
+ Enabled: true
371
+ AutoCorrect: contextual
372
+ VersionAdded: '2.24'
373
+ VersionChanged: '2.31'
374
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata
375
+
376
+ RSpec/EmptyOutput:
377
+ Description: Check that the `output` matcher is not called with an empty string.
378
+ Enabled: true
379
+ VersionAdded: '2.29'
380
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyOutput
381
+
382
+ RSpec/Eq:
383
+ Description: Use `eq` instead of `be ==` to compare objects.
384
+ Enabled: true
385
+ VersionAdded: '2.24'
386
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Eq
387
+
361
388
  RSpec/ExampleLength:
362
389
  Description: Checks for long examples.
363
390
  Enabled: true
@@ -396,7 +423,7 @@ RSpec/ExampleWording:
396
423
 
397
424
  RSpec/ExcessiveDocstringSpacing:
398
425
  Description: Checks for excessive whitespace in example descriptions.
399
- Enabled: pending
426
+ Enabled: true
400
427
  VersionAdded: '2.5'
401
428
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
402
429
 
@@ -404,8 +431,9 @@ RSpec/ExpectActual:
404
431
  Description: Checks for `expect(...)` calls containing literal values.
405
432
  Enabled: true
406
433
  Exclude:
407
- - spec/routing/**/*
434
+ - "**/spec/routing/**/*"
408
435
  VersionAdded: '1.7'
436
+ VersionChanged: '2.23'
409
437
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
410
438
 
411
439
  RSpec/ExpectChange:
@@ -426,32 +454,24 @@ RSpec/ExpectInHook:
426
454
  VersionAdded: '1.16'
427
455
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
428
456
 
457
+ RSpec/ExpectInLet:
458
+ Description: Do not use `expect` in let.
459
+ Enabled: true
460
+ VersionAdded: '2.30'
461
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInLet
462
+
429
463
  RSpec/ExpectOutput:
430
464
  Description: Checks for opportunities to use `expect { ... }.to output`.
431
465
  Enabled: true
432
466
  VersionAdded: '1.10'
433
467
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
434
468
 
435
- RSpec/FilePath:
436
- Description: Checks that spec file paths are consistent and well-formed.
437
- Enabled: true
438
- Include:
439
- - "**/*_spec*rb*"
440
- - "**/spec/**/*"
441
- CustomTransform:
442
- RuboCop: rubocop
443
- RSpec: rspec
444
- IgnoreMethods: false
445
- SpecSuffixOnly: false
446
- VersionAdded: '1.2'
447
- VersionChanged: '1.40'
448
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
449
-
450
469
  RSpec/Focus:
451
470
  Description: Checks if examples are focused.
452
471
  Enabled: true
472
+ AutoCorrect: contextual
453
473
  VersionAdded: '1.5'
454
- VersionChanged: '2.1'
474
+ VersionChanged: '2.31'
455
475
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
456
476
 
457
477
  RSpec/HookArgument:
@@ -469,12 +489,14 @@ RSpec/HookArgument:
469
489
  RSpec/HooksBeforeExamples:
470
490
  Description: Checks for before/around/after hooks that come after an example.
471
491
  Enabled: true
492
+ AutoCorrect: contextual
472
493
  VersionAdded: '1.29'
494
+ VersionChanged: '2.31'
473
495
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
474
496
 
475
497
  RSpec/IdenticalEqualityAssertion:
476
498
  Description: Checks for equality assertions with identical expressions on both sides.
477
- Enabled: pending
499
+ Enabled: true
478
500
  VersionAdded: '2.4'
479
501
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
480
502
 
@@ -511,10 +533,13 @@ RSpec/ImplicitSubject:
511
533
 
512
534
  RSpec/IndexedLet:
513
535
  Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`).
514
- Enabled: pending
536
+ Enabled: true
515
537
  VersionAdded: '2.20'
538
+ VersionChanged: '2.23'
516
539
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet
517
540
  Max: 1
541
+ AllowedIdentifiers: []
542
+ AllowedPatterns: []
518
543
 
519
544
  RSpec/InstanceSpy:
520
545
  Description: Checks for `instance_double` used with `have_received`.
@@ -531,6 +556,13 @@ RSpec/InstanceVariable:
531
556
  StyleGuide: https://rspec.rubystyle.guide/#instance-variables
532
557
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
533
558
 
559
+ RSpec/IsExpectedSpecify:
560
+ Description: Check for `specify` with `is_expected` and one-liner expectations.
561
+ Enabled: true
562
+ VersionAdded: '2.27'
563
+ StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
564
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
565
+
534
566
  RSpec/ItBehavesLike:
535
567
  Description: Checks that only one `it_behaves_like` style is used.
536
568
  Enabled: true
@@ -565,8 +597,9 @@ RSpec/LeakyConstantDeclaration:
565
597
  RSpec/LetBeforeExamples:
566
598
  Description: Checks for `let` definitions that come after an example.
567
599
  Enabled: true
600
+ AutoCorrect: contextual
568
601
  VersionAdded: '1.16'
569
- VersionChanged: '1.22'
602
+ VersionChanged: '2.31'
570
603
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
571
604
 
572
605
  RSpec/LetSetup:
@@ -577,7 +610,7 @@ RSpec/LetSetup:
577
610
 
578
611
  RSpec/MatchArray:
579
612
  Description: Checks where `match_array` is used.
580
- Enabled: pending
613
+ Enabled: true
581
614
  VersionAdded: '2.19'
582
615
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MatchArray
583
616
 
@@ -608,12 +641,28 @@ RSpec/MessageSpies:
608
641
  VersionAdded: '1.9'
609
642
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
610
643
 
644
+ RSpec/MetadataStyle:
645
+ Description: Use consistent metadata style.
646
+ Enabled: true
647
+ EnforcedStyle: symbol
648
+ SupportedStyles:
649
+ - hash
650
+ - symbol
651
+ VersionAdded: '2.24'
652
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MetadataStyle
653
+
611
654
  RSpec/MissingExampleGroupArgument:
612
655
  Description: Checks that the first argument to an example group is not empty.
613
656
  Enabled: true
614
657
  VersionAdded: '1.28'
615
658
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
616
659
 
660
+ RSpec/MissingExpectationTargetMethod:
661
+ Description: Checks if `.to`, `not_to` or `to_not` are used.
662
+ Enabled: true
663
+ VersionAdded: '3.0'
664
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExpectationTargetMethod
665
+
617
666
  RSpec/MultipleDescribes:
618
667
  Description: Checks for multiple top-level example groups.
619
668
  Enabled: true
@@ -668,7 +717,7 @@ RSpec/NestedGroups:
668
717
 
669
718
  RSpec/NoExpectationExample:
670
719
  Description: Checks if an example contains any expectation.
671
- Enabled: pending
720
+ Enabled: true
672
721
  Safe: false
673
722
  VersionAdded: '2.13'
674
723
  VersionChanged: '2.14'
@@ -701,7 +750,7 @@ RSpec/Pending:
701
750
 
702
751
  RSpec/PendingWithoutReason:
703
752
  Description: Checks for pending or skipped examples without reason.
704
- Enabled: pending
753
+ Enabled: true
705
754
  VersionAdded: '2.16'
706
755
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
707
756
 
@@ -725,6 +774,13 @@ RSpec/ReceiveCounts:
725
774
  VersionAdded: '1.26'
726
775
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
727
776
 
777
+ RSpec/ReceiveMessages:
778
+ Description: Checks for multiple messages stubbed on the same object.
779
+ Enabled: true
780
+ SafeAutoCorrect: false
781
+ VersionAdded: '2.23'
782
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
783
+
728
784
  RSpec/ReceiveNever:
729
785
  Description: Prefer `not_to receive(...)` over `receive(...).never`.
730
786
  Enabled: true
@@ -733,10 +789,22 @@ RSpec/ReceiveNever:
733
789
 
734
790
  RSpec/RedundantAround:
735
791
  Description: Remove redundant `around` hook.
736
- Enabled: pending
792
+ Enabled: true
737
793
  VersionAdded: '2.19'
738
794
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
739
795
 
796
+ RSpec/RedundantPredicateMatcher:
797
+ Description: Checks for redundant predicate matcher.
798
+ Enabled: true
799
+ VersionAdded: '2.26'
800
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
801
+
802
+ RSpec/RemoveConst:
803
+ Description: Checks that `remove_const` is not used in specs.
804
+ Enabled: true
805
+ VersionAdded: '2.26'
806
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
807
+
740
808
  RSpec/RepeatedDescription:
741
809
  Description: Check for repeated description strings in example groups.
742
810
  Enabled: true
@@ -767,6 +835,12 @@ RSpec/RepeatedIncludeExample:
767
835
  VersionAdded: '1.44'
768
836
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
769
837
 
838
+ RSpec/RepeatedSubjectCall:
839
+ Description: Checks for repeated calls to subject missing that it is memoized.
840
+ Enabled: true
841
+ VersionAdded: '2.27'
842
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
843
+
770
844
  RSpec/ReturnFromStub:
771
845
  Description: Checks for consistent style of stub's return setting.
772
846
  Enabled: true
@@ -781,14 +855,17 @@ RSpec/ReturnFromStub:
781
855
  RSpec/ScatteredLet:
782
856
  Description: Checks for let scattered across the example group.
783
857
  Enabled: true
858
+ AutoCorrect: contextual
784
859
  VersionAdded: '1.14'
785
- VersionChanged: '1.39'
860
+ VersionChanged: '2.31'
786
861
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
787
862
 
788
863
  RSpec/ScatteredSetup:
789
864
  Description: Checks for setup scattered across multiple hooks in an example group.
790
865
  Enabled: true
866
+ AutoCorrect: contextual
791
867
  VersionAdded: '1.10'
868
+ VersionChanged: '2.31'
792
869
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
793
870
 
794
871
  RSpec/SharedContext:
@@ -798,9 +875,14 @@ RSpec/SharedContext:
798
875
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
799
876
 
800
877
  RSpec/SharedExamples:
801
- Description: Enforces use of string to titleize shared examples.
878
+ Description: Checks for consistent style for shared example names.
802
879
  Enabled: true
880
+ EnforcedStyle: string
881
+ SupportedStyles:
882
+ - string
883
+ - symbol
803
884
  VersionAdded: '1.25'
885
+ VersionChanged: '2.26'
804
886
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
805
887
 
806
888
  RSpec/SingleArgumentMessageChain:
@@ -812,16 +894,41 @@ RSpec/SingleArgumentMessageChain:
812
894
 
813
895
  RSpec/SkipBlockInsideExample:
814
896
  Description: Checks for passing a block to `skip` within examples.
815
- Enabled: pending
897
+ Enabled: true
816
898
  VersionAdded: '2.19'
817
899
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SkipBlockInsideExample
818
900
 
819
901
  RSpec/SortMetadata:
820
902
  Description: Sort RSpec metadata alphabetically.
821
- Enabled: pending
903
+ Enabled: true
822
904
  VersionAdded: '2.14'
823
905
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata
824
906
 
907
+ RSpec/SpecFilePathFormat:
908
+ Description: Checks that spec file paths are consistent and well-formed.
909
+ Enabled: true
910
+ Include:
911
+ - "**/*_spec.rb"
912
+ Exclude:
913
+ - "**/spec/routing/**/*"
914
+ CustomTransform:
915
+ RuboCop: rubocop
916
+ RSpec: rspec
917
+ IgnoreMethods: false
918
+ IgnoreMetadata:
919
+ type: routing
920
+ VersionAdded: '2.24'
921
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathFormat
922
+
923
+ RSpec/SpecFilePathSuffix:
924
+ Description: Checks that spec file paths suffix are consistent and well-formed.
925
+ Enabled: true
926
+ VersionAdded: '2.24'
927
+ Include:
928
+ - "**/*_spec*rb*"
929
+ - "**/spec/**/*"
930
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathSuffix
931
+
825
932
  RSpec/StubbedMock:
826
933
  Description: Checks that message expectations do not have a configured response.
827
934
  Enabled: true
@@ -830,7 +937,7 @@ RSpec/StubbedMock:
830
937
 
831
938
  RSpec/SubjectDeclaration:
832
939
  Description: Ensure that subject is defined using subject helper.
833
- Enabled: pending
940
+ Enabled: true
834
941
  VersionAdded: '2.5'
835
942
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
836
943
 
@@ -842,6 +949,12 @@ RSpec/SubjectStub:
842
949
  StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject
843
950
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
844
951
 
952
+ RSpec/UndescriptiveLiteralsDescription:
953
+ Description: Description should be descriptive.
954
+ Enabled: true
955
+ VersionAdded: '2.29'
956
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UndescriptiveLiteralsDescription
957
+
845
958
  RSpec/UnspecifiedException:
846
959
  Description: Checks for a specified error in checking raised errors.
847
960
  Enabled: true
@@ -872,7 +985,7 @@ RSpec/VariableName:
872
985
 
873
986
  RSpec/VerifiedDoubleReference:
874
987
  Description: Checks for consistent verified double reference style.
875
- Enabled: pending
988
+ Enabled: true
876
989
  SafeAutoCorrect: false
877
990
  EnforcedStyle: constant
878
991
  SupportedStyles:
@@ -903,201 +1016,3 @@ RSpec/Yield:
903
1016
  Enabled: true
904
1017
  VersionAdded: '1.32'
905
1018
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
906
-
907
- RSpec/Capybara:
908
- Enabled: true
909
- Include: *1
910
- Language: *2
911
-
912
- RSpec/Capybara/CurrentPathExpectation:
913
- Description: Checks that no expectations are set on Capybara's `current_path`.
914
- Enabled: true
915
- VersionAdded: '1.18'
916
- VersionChanged: '2.0'
917
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
918
-
919
- RSpec/Capybara/FeatureMethods:
920
- Description: Checks for consistent method usage in feature specs.
921
- Enabled: true
922
- EnabledMethods: []
923
- VersionAdded: '1.17'
924
- VersionChanged: '2.0'
925
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
926
-
927
- RSpec/Capybara/MatchStyle:
928
- Description: Checks for usage of deprecated style methods.
929
- Enabled: pending
930
- VersionAdded: '2.17'
931
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle
932
-
933
- RSpec/Capybara/NegationMatcher:
934
- Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
935
- Enabled: pending
936
- VersionAdded: '2.14'
937
- EnforcedStyle: not_to
938
- SupportedStyles:
939
- - have_no
940
- - not_to
941
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher
942
-
943
- RSpec/Capybara/SpecificActions:
944
- Description: Checks for there is a more specific actions offered by Capybara.
945
- Enabled: pending
946
- VersionAdded: '2.14'
947
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions
948
-
949
- RSpec/Capybara/SpecificFinders:
950
- Description: Checks if there is a more specific finder offered by Capybara.
951
- Enabled: pending
952
- VersionAdded: '2.13'
953
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders
954
-
955
- RSpec/Capybara/SpecificMatcher:
956
- Description: Checks for there is a more specific matcher offered by Capybara.
957
- Enabled: pending
958
- VersionAdded: '2.12'
959
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher
960
-
961
- RSpec/Capybara/VisibilityMatcher:
962
- Description: Checks for boolean visibility in Capybara finders.
963
- Enabled: true
964
- VersionAdded: '1.39'
965
- VersionChanged: '2.0'
966
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
967
-
968
- RSpec/FactoryBot:
969
- Enabled: true
970
- Include: *1
971
- Language: *2
972
-
973
- RSpec/FactoryBot/AttributeDefinedStatically:
974
- Description: Always declare attribute values as blocks.
975
- Enabled: true
976
- Include:
977
- - spec/factories.rb
978
- - spec/factories/**/*.rb
979
- - features/support/factories/**/*.rb
980
- VersionAdded: '1.28'
981
- VersionChanged: '2.0'
982
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
983
-
984
- RSpec/FactoryBot/ConsistentParenthesesStyle:
985
- Description: Use a consistent style for parentheses in factory bot calls.
986
- Enabled: pending
987
- EnforcedStyle: require_parentheses
988
- SupportedStyles:
989
- - require_parentheses
990
- - omit_parentheses
991
- VersionAdded: '2.14'
992
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle
993
-
994
- RSpec/FactoryBot/CreateList:
995
- Description: Checks for create_list usage.
996
- Enabled: true
997
- Include:
998
- - "**/*_spec.rb"
999
- - "**/spec/**/*"
1000
- - spec/factories.rb
1001
- - spec/factories/**/*.rb
1002
- - features/support/factories/**/*.rb
1003
- EnforcedStyle: create_list
1004
- SupportedStyles:
1005
- - create_list
1006
- - n_times
1007
- VersionAdded: '1.25'
1008
- VersionChanged: '2.0'
1009
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
1010
-
1011
- RSpec/FactoryBot/FactoryClassName:
1012
- Description: Use string value when setting the class attribute explicitly.
1013
- Enabled: true
1014
- Include:
1015
- - spec/factories.rb
1016
- - spec/factories/**/*.rb
1017
- - features/support/factories/**/*.rb
1018
- VersionAdded: '1.37'
1019
- VersionChanged: '2.0'
1020
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
1021
-
1022
- RSpec/FactoryBot/FactoryNameStyle:
1023
- Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
1024
- Enabled: pending
1025
- VersionAdded: '2.16'
1026
- EnforcedStyle: symbol
1027
- SupportedStyles:
1028
- - symbol
1029
- - string
1030
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
1031
-
1032
- RSpec/FactoryBot/SyntaxMethods:
1033
- Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
1034
- Enabled: pending
1035
- SafeAutoCorrect: false
1036
- VersionAdded: '2.7'
1037
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
1038
-
1039
- RSpec/Rails:
1040
- Enabled: true
1041
- Include: *1
1042
- Language: *2
1043
-
1044
- RSpec/Rails/AvoidSetupHook:
1045
- Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
1046
- Enabled: pending
1047
- VersionAdded: '2.4'
1048
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
1049
-
1050
- RSpec/Rails/HaveHttpStatus:
1051
- Description: Checks that tests use `have_http_status` instead of equality matchers.
1052
- Enabled: pending
1053
- SafeAutoCorrect: false
1054
- VersionAdded: '2.12'
1055
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
1056
-
1057
- RSpec/Rails/HttpStatus:
1058
- Description: Enforces use of symbolic or numeric value to describe HTTP status.
1059
- Enabled: true
1060
- EnforcedStyle: symbolic
1061
- SupportedStyles:
1062
- - numeric
1063
- - symbolic
1064
- - be_status
1065
- VersionAdded: '1.23'
1066
- VersionChanged: '2.20'
1067
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
1068
-
1069
- RSpec/Rails/InferredSpecType:
1070
- Description: Identifies redundant spec type.
1071
- Enabled: pending
1072
- Safe: false
1073
- VersionAdded: '2.14'
1074
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType
1075
- Inferences:
1076
- channels: channel
1077
- controllers: controller
1078
- features: feature
1079
- generator: generator
1080
- helpers: helper
1081
- jobs: job
1082
- mailboxes: mailbox
1083
- mailers: mailer
1084
- models: model
1085
- requests: request
1086
- integration: request
1087
- api: request
1088
- routing: routing
1089
- system: system
1090
- views: view
1091
-
1092
- RSpec/Rails/MinitestAssertions:
1093
- Description: Check if using Minitest matchers.
1094
- Enabled: pending
1095
- VersionAdded: '2.17'
1096
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
1097
-
1098
- RSpec/Rails/TravelAround:
1099
- Description: Prefer to travel in `before` rather than `around`.
1100
- Enabled: pending
1101
- Safe: false
1102
- VersionAdded: '2.19'
1103
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround