rubocop-rspec 2.29.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -3
  3. data/README.md +21 -5
  4. data/config/default.yml +64 -269
  5. data/config/obsoletion.yml +20 -21
  6. data/lib/rubocop/cop/rspec/around_block.rb +2 -4
  7. data/lib/rubocop/cop/rspec/base.rb +0 -1
  8. data/lib/rubocop/cop/rspec/be_eq.rb +1 -1
  9. data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
  10. data/lib/rubocop/cop/rspec/be_nil.rb +4 -0
  11. data/lib/rubocop/cop/rspec/change_by_zero.rb +4 -5
  12. data/lib/rubocop/cop/rspec/contain_exactly.rb +1 -0
  13. data/lib/rubocop/cop/rspec/context_wording.rb +15 -9
  14. data/lib/rubocop/cop/rspec/dialect.rb +13 -0
  15. data/lib/rubocop/cop/rspec/empty_example_group.rb +2 -0
  16. data/lib/rubocop/cop/rspec/empty_metadata.rb +1 -0
  17. data/lib/rubocop/cop/rspec/example_wording.rb +3 -5
  18. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +1 -1
  19. data/lib/rubocop/cop/rspec/expect_actual.rb +3 -3
  20. data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
  21. data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
  22. data/lib/rubocop/cop/rspec/focus.rb +14 -16
  23. data/lib/rubocop/cop/rspec/implicit_expect.rb +3 -3
  24. data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -0
  25. data/lib/rubocop/cop/rspec/indexed_let.rb +6 -3
  26. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -1
  27. data/lib/rubocop/cop/rspec/match_array.rb +1 -0
  28. data/lib/rubocop/cop/rspec/message_spies.rb +4 -0
  29. data/lib/rubocop/cop/rspec/metadata_style.rb +1 -6
  30. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  31. data/lib/rubocop/cop/rspec/mixin/metadata.rb +5 -8
  32. data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +7 -0
  33. data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
  34. data/lib/rubocop/cop/rspec/multiple_expectations.rb +4 -4
  35. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +4 -5
  36. data/lib/rubocop/cop/rspec/named_subject.rb +5 -2
  37. data/lib/rubocop/cop/rspec/nested_groups.rb +2 -1
  38. data/lib/rubocop/cop/rspec/pending_without_reason.rb +0 -5
  39. data/lib/rubocop/cop/rspec/predicate_matcher.rb +25 -11
  40. data/lib/rubocop/cop/rspec/remove_const.rb +0 -1
  41. data/lib/rubocop/cop/rspec/repeated_subject_call.rb +1 -0
  42. data/lib/rubocop/cop/rspec/return_from_stub.rb +5 -4
  43. data/lib/rubocop/cop/rspec/scattered_setup.rb +7 -1
  44. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +3 -4
  45. data/lib/rubocop/cop/rspec/sort_metadata.rb +22 -8
  46. data/lib/rubocop/cop/rspec/stubbed_mock.rb +15 -10
  47. data/lib/rubocop/cop/rspec/subject_stub.rb +2 -2
  48. data/lib/rubocop/cop/rspec/unspecified_exception.rb +21 -14
  49. data/lib/rubocop/cop/rspec/verified_double_reference.rb +14 -53
  50. data/lib/rubocop/cop/rspec/void_expect.rb +6 -1
  51. data/lib/rubocop/cop/rspec_cops.rb +2 -25
  52. data/lib/rubocop/rspec/concept.rb +0 -1
  53. data/lib/rubocop/rspec/config_formatter.rb +4 -32
  54. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  55. data/lib/rubocop/rspec/description_extractor.rb +2 -2
  56. data/lib/rubocop/rspec/hook.rb +1 -1
  57. data/lib/rubocop/rspec/language.rb +0 -1
  58. data/lib/rubocop/rspec/node.rb +1 -1
  59. data/lib/rubocop/rspec/plugin.rb +37 -0
  60. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +1 -1
  61. data/lib/rubocop/rspec/version.rb +1 -1
  62. data/lib/rubocop/rspec/wording.rb +2 -4
  63. data/lib/rubocop/rspec.rb +0 -7
  64. data/lib/rubocop-rspec.rb +2 -20
  65. metadata +18 -62
  66. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +0 -39
  67. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +0 -104
  68. data/lib/rubocop/cop/rspec/capybara/match_style.rb +0 -38
  69. data/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +0 -33
  70. data/lib/rubocop/cop/rspec/capybara/specific_actions.rb +0 -29
  71. data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +0 -24
  72. data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +0 -35
  73. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -36
  74. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +0 -35
  75. data/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +0 -50
  76. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +0 -40
  77. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +0 -29
  78. data/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +0 -33
  79. data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +0 -55
  80. data/lib/rubocop/cop/rspec/file_path.rb +0 -179
  81. data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +0 -27
  82. data/lib/rubocop/cop/rspec/rails/have_http_status.rb +0 -35
  83. data/lib/rubocop/cop/rspec/rails/http_status.rb +0 -61
  84. data/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb +0 -62
  85. data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +0 -39
  86. data/lib/rubocop/cop/rspec/rails/negation_be_valid.rb +0 -39
  87. data/lib/rubocop/cop/rspec/rails/travel_around.rb +0 -34
  88. data/lib/rubocop/rspec/inject.rb +0 -18
  89. 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
@@ -191,7 +193,7 @@ RSpec/BeforeAfterAll:
191
193
 
192
194
  RSpec/ChangeByZero:
193
195
  Description: Prefer negated matchers over `to change.by(0)`.
194
- Enabled: pending
196
+ Enabled: true
195
197
  VersionAdded: '2.11'
196
198
  VersionChanged: '2.14'
197
199
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero
@@ -200,7 +202,7 @@ RSpec/ChangeByZero:
200
202
  RSpec/ClassCheck:
201
203
  Description: Enforces consistent use of `be_a` or `be_kind_of`.
202
204
  StyleGuide: "#is-a-vs-kind-of"
203
- Enabled: pending
205
+ Enabled: true
204
206
  VersionAdded: '2.13'
205
207
  EnforcedStyle: be_a
206
208
  SupportedStyles:
@@ -210,7 +212,7 @@ RSpec/ClassCheck:
210
212
 
211
213
  RSpec/ContainExactly:
212
214
  Description: Checks where `contain_exactly` is used.
213
- Enabled: pending
215
+ Enabled: true
214
216
  VersionAdded: '2.19'
215
217
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContainExactly
216
218
 
@@ -304,22 +306,25 @@ RSpec/Dialect:
304
306
 
305
307
  RSpec/DuplicatedMetadata:
306
308
  Description: Avoid duplicated metadata.
307
- Enabled: pending
309
+ Enabled: true
308
310
  VersionAdded: '2.16'
309
311
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
310
312
 
311
313
  RSpec/EmptyExampleGroup:
312
314
  Description: Checks if an example group does not include any tests.
313
315
  Enabled: true
316
+ AutoCorrect: contextual
314
317
  SafeAutoCorrect: false
315
318
  VersionAdded: '1.7'
316
- VersionChanged: '2.13'
319
+ VersionChanged: '2.31'
317
320
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
318
321
 
319
322
  RSpec/EmptyHook:
320
323
  Description: Checks for empty before and after hooks.
321
324
  Enabled: true
325
+ AutoCorrect: contextual
322
326
  VersionAdded: '1.39'
327
+ VersionChanged: '2.31'
323
328
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
324
329
 
325
330
  RSpec/EmptyLineAfterExample:
@@ -362,19 +367,21 @@ RSpec/EmptyLineAfterSubject:
362
367
 
363
368
  RSpec/EmptyMetadata:
364
369
  Description: Avoid empty metadata hash.
365
- Enabled: pending
370
+ Enabled: true
371
+ AutoCorrect: contextual
366
372
  VersionAdded: '2.24'
373
+ VersionChanged: '2.31'
367
374
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata
368
375
 
369
376
  RSpec/EmptyOutput:
370
377
  Description: Check that the `output` matcher is not called with an empty string.
371
- Enabled: pending
378
+ Enabled: true
372
379
  VersionAdded: '2.29'
373
380
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyOutput
374
381
 
375
382
  RSpec/Eq:
376
383
  Description: Use `eq` instead of `be ==` to compare objects.
377
- Enabled: pending
384
+ Enabled: true
378
385
  VersionAdded: '2.24'
379
386
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Eq
380
387
 
@@ -396,6 +403,7 @@ RSpec/ExampleWithoutDescription:
396
403
  - single_line_only
397
404
  - disallow
398
405
  VersionAdded: '1.22'
406
+ StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
399
407
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
400
408
 
401
409
  RSpec/ExampleWording:
@@ -416,7 +424,7 @@ RSpec/ExampleWording:
416
424
 
417
425
  RSpec/ExcessiveDocstringSpacing:
418
426
  Description: Checks for excessive whitespace in example descriptions.
419
- Enabled: pending
427
+ Enabled: true
420
428
  VersionAdded: '2.5'
421
429
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
422
430
 
@@ -447,32 +455,24 @@ RSpec/ExpectInHook:
447
455
  VersionAdded: '1.16'
448
456
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
449
457
 
458
+ RSpec/ExpectInLet:
459
+ Description: Do not use `expect` in let.
460
+ Enabled: true
461
+ VersionAdded: '2.30'
462
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInLet
463
+
450
464
  RSpec/ExpectOutput:
451
465
  Description: Checks for opportunities to use `expect { ... }.to output`.
452
466
  Enabled: true
453
467
  VersionAdded: '1.10'
454
468
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
455
469
 
456
- RSpec/FilePath:
457
- Description: Checks that spec file paths are consistent and well-formed.
458
- Enabled: true
459
- Include:
460
- - "**/*_spec*rb*"
461
- - "**/spec/**/*"
462
- CustomTransform:
463
- RuboCop: rubocop
464
- RSpec: rspec
465
- IgnoreMethods: false
466
- SpecSuffixOnly: false
467
- VersionAdded: '1.2'
468
- VersionChanged: '2.24'
469
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
470
-
471
470
  RSpec/Focus:
472
471
  Description: Checks if examples are focused.
473
472
  Enabled: true
473
+ AutoCorrect: contextual
474
474
  VersionAdded: '1.5'
475
- VersionChanged: '2.1'
475
+ VersionChanged: '2.31'
476
476
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
477
477
 
478
478
  RSpec/HookArgument:
@@ -490,12 +490,14 @@ RSpec/HookArgument:
490
490
  RSpec/HooksBeforeExamples:
491
491
  Description: Checks for before/around/after hooks that come after an example.
492
492
  Enabled: true
493
+ AutoCorrect: contextual
493
494
  VersionAdded: '1.29'
495
+ VersionChanged: '2.31'
494
496
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
495
497
 
496
498
  RSpec/IdenticalEqualityAssertion:
497
499
  Description: Checks for equality assertions with identical expressions on both sides.
498
- Enabled: pending
500
+ Enabled: true
499
501
  VersionAdded: '2.4'
500
502
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
501
503
 
@@ -532,7 +534,7 @@ RSpec/ImplicitSubject:
532
534
 
533
535
  RSpec/IndexedLet:
534
536
  Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`).
535
- Enabled: pending
537
+ Enabled: true
536
538
  VersionAdded: '2.20'
537
539
  VersionChanged: '2.23'
538
540
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet
@@ -557,7 +559,7 @@ RSpec/InstanceVariable:
557
559
 
558
560
  RSpec/IsExpectedSpecify:
559
561
  Description: Check for `specify` with `is_expected` and one-liner expectations.
560
- Enabled: pending
562
+ Enabled: true
561
563
  VersionAdded: '2.27'
562
564
  StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
563
565
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
@@ -596,8 +598,9 @@ RSpec/LeakyConstantDeclaration:
596
598
  RSpec/LetBeforeExamples:
597
599
  Description: Checks for `let` definitions that come after an example.
598
600
  Enabled: true
601
+ AutoCorrect: contextual
599
602
  VersionAdded: '1.16'
600
- VersionChanged: '1.22'
603
+ VersionChanged: '2.31'
601
604
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
602
605
 
603
606
  RSpec/LetSetup:
@@ -608,7 +611,7 @@ RSpec/LetSetup:
608
611
 
609
612
  RSpec/MatchArray:
610
613
  Description: Checks where `match_array` is used.
611
- Enabled: pending
614
+ Enabled: true
612
615
  VersionAdded: '2.19'
613
616
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MatchArray
614
617
 
@@ -641,7 +644,7 @@ RSpec/MessageSpies:
641
644
 
642
645
  RSpec/MetadataStyle:
643
646
  Description: Use consistent metadata style.
644
- Enabled: pending
647
+ Enabled: true
645
648
  EnforcedStyle: symbol
646
649
  SupportedStyles:
647
650
  - hash
@@ -655,6 +658,12 @@ RSpec/MissingExampleGroupArgument:
655
658
  VersionAdded: '1.28'
656
659
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
657
660
 
661
+ RSpec/MissingExpectationTargetMethod:
662
+ Description: Checks if `.to`, `not_to` or `to_not` are used.
663
+ Enabled: true
664
+ VersionAdded: '3.0'
665
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExpectationTargetMethod
666
+
658
667
  RSpec/MultipleDescribes:
659
668
  Description: Checks for multiple top-level example groups.
660
669
  Enabled: true
@@ -709,7 +718,7 @@ RSpec/NestedGroups:
709
718
 
710
719
  RSpec/NoExpectationExample:
711
720
  Description: Checks if an example contains any expectation.
712
- Enabled: pending
721
+ Enabled: true
713
722
  Safe: false
714
723
  VersionAdded: '2.13'
715
724
  VersionChanged: '2.14'
@@ -742,7 +751,7 @@ RSpec/Pending:
742
751
 
743
752
  RSpec/PendingWithoutReason:
744
753
  Description: Checks for pending or skipped examples without reason.
745
- Enabled: pending
754
+ Enabled: true
746
755
  VersionAdded: '2.16'
747
756
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
748
757
 
@@ -768,7 +777,7 @@ RSpec/ReceiveCounts:
768
777
 
769
778
  RSpec/ReceiveMessages:
770
779
  Description: Checks for multiple messages stubbed on the same object.
771
- Enabled: pending
780
+ Enabled: true
772
781
  SafeAutoCorrect: false
773
782
  VersionAdded: '2.23'
774
783
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
@@ -781,19 +790,19 @@ RSpec/ReceiveNever:
781
790
 
782
791
  RSpec/RedundantAround:
783
792
  Description: Remove redundant `around` hook.
784
- Enabled: pending
793
+ Enabled: true
785
794
  VersionAdded: '2.19'
786
795
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
787
796
 
788
797
  RSpec/RedundantPredicateMatcher:
789
798
  Description: Checks for redundant predicate matcher.
790
- Enabled: pending
799
+ Enabled: true
791
800
  VersionAdded: '2.26'
792
801
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
793
802
 
794
803
  RSpec/RemoveConst:
795
804
  Description: Checks that `remove_const` is not used in specs.
796
- Enabled: pending
805
+ Enabled: true
797
806
  VersionAdded: '2.26'
798
807
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
799
808
 
@@ -829,7 +838,7 @@ RSpec/RepeatedIncludeExample:
829
838
 
830
839
  RSpec/RepeatedSubjectCall:
831
840
  Description: Checks for repeated calls to subject missing that it is memoized.
832
- Enabled: pending
841
+ Enabled: true
833
842
  VersionAdded: '2.27'
834
843
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
835
844
 
@@ -847,14 +856,17 @@ RSpec/ReturnFromStub:
847
856
  RSpec/ScatteredLet:
848
857
  Description: Checks for let scattered across the example group.
849
858
  Enabled: true
859
+ AutoCorrect: contextual
850
860
  VersionAdded: '1.14'
851
- VersionChanged: '1.39'
861
+ VersionChanged: '2.31'
852
862
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
853
863
 
854
864
  RSpec/ScatteredSetup:
855
865
  Description: Checks for setup scattered across multiple hooks in an example group.
856
866
  Enabled: true
867
+ AutoCorrect: contextual
857
868
  VersionAdded: '1.10'
869
+ VersionChanged: '2.31'
858
870
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
859
871
 
860
872
  RSpec/SharedContext:
@@ -883,19 +895,19 @@ RSpec/SingleArgumentMessageChain:
883
895
 
884
896
  RSpec/SkipBlockInsideExample:
885
897
  Description: Checks for passing a block to `skip` within examples.
886
- Enabled: pending
898
+ Enabled: true
887
899
  VersionAdded: '2.19'
888
900
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SkipBlockInsideExample
889
901
 
890
902
  RSpec/SortMetadata:
891
903
  Description: Sort RSpec metadata alphabetically.
892
- Enabled: pending
904
+ Enabled: true
893
905
  VersionAdded: '2.14'
894
906
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata
895
907
 
896
908
  RSpec/SpecFilePathFormat:
897
909
  Description: Checks that spec file paths are consistent and well-formed.
898
- Enabled: pending
910
+ Enabled: true
899
911
  Include:
900
912
  - "**/*_spec.rb"
901
913
  Exclude:
@@ -911,7 +923,7 @@ RSpec/SpecFilePathFormat:
911
923
 
912
924
  RSpec/SpecFilePathSuffix:
913
925
  Description: Checks that spec file paths suffix are consistent and well-formed.
914
- Enabled: pending
926
+ Enabled: true
915
927
  VersionAdded: '2.24'
916
928
  Include:
917
929
  - "**/*_spec*rb*"
@@ -926,7 +938,7 @@ RSpec/StubbedMock:
926
938
 
927
939
  RSpec/SubjectDeclaration:
928
940
  Description: Ensure that subject is defined using subject helper.
929
- Enabled: pending
941
+ Enabled: true
930
942
  VersionAdded: '2.5'
931
943
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
932
944
 
@@ -940,7 +952,7 @@ RSpec/SubjectStub:
940
952
 
941
953
  RSpec/UndescriptiveLiteralsDescription:
942
954
  Description: Description should be descriptive.
943
- Enabled: pending
955
+ Enabled: true
944
956
  VersionAdded: '2.29'
945
957
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UndescriptiveLiteralsDescription
946
958
 
@@ -974,14 +986,10 @@ RSpec/VariableName:
974
986
 
975
987
  RSpec/VerifiedDoubleReference:
976
988
  Description: Checks for consistent verified double reference style.
977
- Enabled: pending
989
+ Enabled: true
978
990
  SafeAutoCorrect: false
979
- EnforcedStyle: constant
980
- SupportedStyles:
981
- - constant
982
- - string
983
991
  VersionAdded: 2.10.0
984
- VersionChanged: '2.12'
992
+ VersionChanged: '3.4'
985
993
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference
986
994
 
987
995
  RSpec/VerifiedDoubles:
@@ -1005,216 +1013,3 @@ RSpec/Yield:
1005
1013
  Enabled: true
1006
1014
  VersionAdded: '1.32'
1007
1015
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
1008
-
1009
- RSpec/Capybara:
1010
- Enabled: true
1011
- Include: *1
1012
- Language: *2
1013
-
1014
- RSpec/Capybara/CurrentPathExpectation:
1015
- Description: Checks that no expectations are set on Capybara's `current_path`.
1016
- Enabled: true
1017
- VersionAdded: '1.18'
1018
- VersionChanged: '2.0'
1019
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
1020
-
1021
- RSpec/Capybara/FeatureMethods:
1022
- Description: Checks for consistent method usage in feature specs.
1023
- Enabled: true
1024
- EnabledMethods: []
1025
- VersionAdded: '1.17'
1026
- VersionChanged: '2.0'
1027
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
1028
-
1029
- RSpec/Capybara/MatchStyle:
1030
- Description: Checks for usage of deprecated style methods.
1031
- Enabled: pending
1032
- VersionAdded: '2.17'
1033
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle
1034
-
1035
- RSpec/Capybara/NegationMatcher:
1036
- Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
1037
- Enabled: pending
1038
- VersionAdded: '2.14'
1039
- EnforcedStyle: not_to
1040
- SupportedStyles:
1041
- - have_no
1042
- - not_to
1043
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher
1044
-
1045
- RSpec/Capybara/SpecificActions:
1046
- Description: Checks for there is a more specific actions offered by Capybara.
1047
- Enabled: pending
1048
- VersionAdded: '2.14'
1049
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions
1050
-
1051
- RSpec/Capybara/SpecificFinders:
1052
- Description: Checks if there is a more specific finder offered by Capybara.
1053
- Enabled: pending
1054
- VersionAdded: '2.13'
1055
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders
1056
-
1057
- RSpec/Capybara/SpecificMatcher:
1058
- Description: Checks for there is a more specific matcher offered by Capybara.
1059
- Enabled: pending
1060
- VersionAdded: '2.12'
1061
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher
1062
-
1063
- RSpec/Capybara/VisibilityMatcher:
1064
- Description: Checks for boolean visibility in Capybara finders.
1065
- Enabled: true
1066
- VersionAdded: '1.39'
1067
- VersionChanged: '2.0'
1068
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
1069
-
1070
- RSpec/FactoryBot:
1071
- Enabled: true
1072
- Include: *1
1073
- Language: *2
1074
-
1075
- RSpec/FactoryBot/AttributeDefinedStatically:
1076
- Description: Always declare attribute values as blocks.
1077
- Enabled: true
1078
- Include:
1079
- - "**/spec/factories.rb"
1080
- - "**/spec/factories/**/*.rb"
1081
- - "**/features/support/factories/**/*.rb"
1082
- VersionAdded: '1.28'
1083
- VersionChanged: '2.23'
1084
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
1085
-
1086
- RSpec/FactoryBot/ConsistentParenthesesStyle:
1087
- Description: Use a consistent style for parentheses in factory bot calls.
1088
- Enabled: pending
1089
- EnforcedStyle: require_parentheses
1090
- SupportedStyles:
1091
- - require_parentheses
1092
- - omit_parentheses
1093
- VersionAdded: '2.14'
1094
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle
1095
-
1096
- RSpec/FactoryBot/CreateList:
1097
- Description: Checks for create_list usage.
1098
- Enabled: true
1099
- Include:
1100
- - "**/*_spec.rb"
1101
- - "**/spec/**/*"
1102
- - "**/spec/factories.rb"
1103
- - "**/spec/factories/**/*.rb"
1104
- - "**/features/support/factories/**/*.rb"
1105
- EnforcedStyle: create_list
1106
- SupportedStyles:
1107
- - create_list
1108
- - n_times
1109
- VersionAdded: '1.25'
1110
- VersionChanged: '2.23'
1111
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
1112
-
1113
- RSpec/FactoryBot/FactoryClassName:
1114
- Description: Use string value when setting the class attribute explicitly.
1115
- Enabled: true
1116
- Include:
1117
- - "**/spec/factories.rb"
1118
- - "**/spec/factories/**/*.rb"
1119
- - "**/features/support/factories/**/*.rb"
1120
- VersionAdded: '1.37'
1121
- VersionChanged: '2.23'
1122
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
1123
-
1124
- RSpec/FactoryBot/FactoryNameStyle:
1125
- Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
1126
- Enabled: pending
1127
- VersionAdded: '2.16'
1128
- EnforcedStyle: symbol
1129
- SupportedStyles:
1130
- - symbol
1131
- - string
1132
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
1133
-
1134
- RSpec/FactoryBot/SyntaxMethods:
1135
- Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
1136
- Enabled: pending
1137
- SafeAutoCorrect: false
1138
- VersionAdded: '2.7'
1139
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
1140
-
1141
- RSpec/Rails:
1142
- Enabled: true
1143
- Include: *1
1144
- Language: *2
1145
-
1146
- RSpec/Rails/AvoidSetupHook:
1147
- Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
1148
- Enabled: pending
1149
- VersionAdded: '2.4'
1150
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
1151
-
1152
- RSpec/Rails/HaveHttpStatus:
1153
- Description: Checks that tests use `have_http_status` instead of equality matchers.
1154
- Enabled: pending
1155
- ResponseMethods:
1156
- - response
1157
- - last_response
1158
- SafeAutoCorrect: false
1159
- VersionAdded: '2.12'
1160
- VersionChanged: '2.27'
1161
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
1162
-
1163
- RSpec/Rails/HttpStatus:
1164
- Description: Enforces use of symbolic or numeric value to describe HTTP status.
1165
- Enabled: true
1166
- EnforcedStyle: symbolic
1167
- SupportedStyles:
1168
- - numeric
1169
- - symbolic
1170
- - be_status
1171
- VersionAdded: '1.23'
1172
- VersionChanged: '2.20'
1173
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
1174
-
1175
- RSpec/Rails/InferredSpecType:
1176
- Description: Identifies redundant spec type.
1177
- Enabled: pending
1178
- Safe: false
1179
- VersionAdded: '2.14'
1180
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType
1181
- Inferences:
1182
- channels: channel
1183
- controllers: controller
1184
- features: feature
1185
- generator: generator
1186
- helpers: helper
1187
- jobs: job
1188
- mailboxes: mailbox
1189
- mailers: mailer
1190
- models: model
1191
- requests: request
1192
- integration: request
1193
- api: request
1194
- routing: routing
1195
- system: system
1196
- views: view
1197
-
1198
- RSpec/Rails/MinitestAssertions:
1199
- Description: Check if using Minitest-like matchers.
1200
- Enabled: pending
1201
- VersionAdded: '2.17'
1202
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
1203
-
1204
- RSpec/Rails/NegationBeValid:
1205
- Description: Enforces use of `be_invalid` or `not_to` for negated be_valid.
1206
- Safe: false
1207
- EnforcedStyle: not_to
1208
- SupportedStyles:
1209
- - not_to
1210
- - be_invalid
1211
- Enabled: pending
1212
- VersionAdded: '2.23'
1213
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/NegationBeValid
1214
-
1215
- RSpec/Rails/TravelAround:
1216
- Description: Prefer to travel in `before` rather than `around`.
1217
- Enabled: pending
1218
- Safe: false
1219
- VersionAdded: '2.19'
1220
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround
@@ -12,25 +12,24 @@ changed_parameters:
12
12
  parameters: IgnoredPatterns
13
13
  alternative: AllowedPatterns
14
14
  severity: warning
15
+ - cops: RSpec/VerifiedDoubleReference
16
+ parameters: EnforcedStyle
17
+ reason: String references are not verifying unless the class is loaded.
15
18
 
16
- renamed:
17
- RSpec/Capybara/CurrentPathExpectation: Capybara/CurrentPathExpectation
18
- RSpec/Capybara/MatchStyle: Capybara/MatchStyle
19
- RSpec/Capybara/NegationMatcher: Capybara/NegationMatcher
20
- RSpec/Capybara/SpecificActions: Capybara/SpecificActions
21
- RSpec/Capybara/SpecificFinders: Capybara/SpecificFinders
22
- RSpec/Capybara/SpecificMatcher: Capybara/SpecificMatcher
23
- RSpec/Capybara/VisibilityMatcher: Capybara/VisibilityMatcher
24
- RSpec/FactoryBot/AttributeDefinedStatically: FactoryBot/AttributeDefinedStatically
25
- RSpec/FactoryBot/ConsistentParenthesesStyle: FactoryBot/ConsistentParenthesesStyle
26
- RSpec/FactoryBot/CreateList: FactoryBot/CreateList
27
- RSpec/FactoryBot/FactoryClassName: FactoryBot/FactoryClassName
28
- RSpec/FactoryBot/FactoryNameStyle: FactoryBot/FactoryNameStyle
29
- RSpec/FactoryBot/SyntaxMethods: FactoryBot/SyntaxMethods
30
- RSpec/Rails/AvoidSetupHook: RSpecRails/AvoidSetupHook
31
- RSpec/Rails/HaveHttpStatus: RSpecRails/HaveHttpStatus
32
- RSpec/Rails/HttpStatus: RSpecRails/HttpStatus
33
- RSpec/Rails/InferredSpecType: RSpecRails/InferredSpecType
34
- RSpec/Rails/MinitestAssertions: RSpecRails/MinitestAssertions
35
- RSpec/Rails/NegationBeValid: RSpecRails/NegationBeValid
36
- RSpec/Rails/TravelAround: RSpecRails/TravelAround
19
+ split:
20
+ RSpec/FilePath:
21
+ alternatives:
22
+ - RSpec/SpecFilePathFormat
23
+ - RSpec/SpecFilePathSuffix
24
+
25
+ removed:
26
+ RSpec/Capybara/FeatureMethods:
27
+ reason: >
28
+ this cop has migrated to `RSpec/Dialect`. Please use `RSpec/Dialect` instead
29
+ RSpec/StringAsInstanceDoubleConstant:
30
+ reason: Please use `RSpec/VerifiedDoubleReference` instead
31
+
32
+ extracted:
33
+ RSpec/Rails/*: rubocop-rspec_rails
34
+ RSpec/FactoryBot/*: rubocop-factory_bot
35
+ RSpec/Capybara/*: rubocop-capybara
@@ -69,15 +69,13 @@ module RuboCop
69
69
  end
70
70
 
71
71
  def check_for_unused_proxy(block, proxy)
72
- name, = *proxy
73
-
74
72
  find_arg_usage(block) do |usage|
75
- return if usage.include?(s(:lvar, name))
73
+ return if usage.include?(s(:lvar, proxy.name))
76
74
  end
77
75
 
78
76
  add_offense(
79
77
  proxy,
80
- message: format(MSG_UNUSED_ARG, arg: name)
78
+ message: format(MSG_UNUSED_ARG, arg: proxy.name)
81
79
  )
82
80
  end
83
81
 
@@ -6,7 +6,6 @@ module RuboCop
6
6
  # @abstract parent class to RSpec cops
7
7
  class Base < ::RuboCop::Cop::Base
8
8
  include RuboCop::RSpec::Language
9
- extend RuboCop::RSpec::Language::NodePattern
10
9
 
11
10
  exclude_from_registry
12
11
 
@@ -31,7 +31,7 @@ module RuboCop
31
31
 
32
32
  # @!method eq_type_with_identity?(node)
33
33
  def_node_matcher :eq_type_with_identity?, <<~PATTERN
34
- (send nil? :eq {true false nil})
34
+ (send nil? :eq {boolean nil})
35
35
  PATTERN
36
36
 
37
37
  def on_send(node)