rubocop-rspec 2.31.0 → 3.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/config/default.yml +39 -261
  5. data/config/obsoletion.yml +11 -0
  6. data/lib/rubocop/cop/rspec/base.rb +0 -1
  7. data/lib/rubocop/cop/rspec/dialect.rb +13 -0
  8. data/lib/rubocop/cop/rspec/expect_actual.rb +1 -1
  9. data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
  10. data/lib/rubocop/cop/rspec/expect_in_let.rb +1 -3
  11. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -1
  12. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  13. data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
  14. data/lib/rubocop/cop/rspec/multiple_expectations.rb +2 -2
  15. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +2 -4
  16. data/lib/rubocop/cop/rspec/named_subject.rb +5 -2
  17. data/lib/rubocop/cop/rspec/predicate_matcher.rb +1 -1
  18. data/lib/rubocop/cop/rspec/remove_const.rb +0 -1
  19. data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
  20. data/lib/rubocop/cop/rspec/sort_metadata.rb +1 -1
  21. data/lib/rubocop/cop/rspec/stubbed_mock.rb +3 -1
  22. data/lib/rubocop/cop/rspec/subject_stub.rb +2 -2
  23. data/lib/rubocop/cop/rspec_cops.rb +1 -25
  24. data/lib/rubocop/rspec/concept.rb +0 -1
  25. data/lib/rubocop/rspec/config_formatter.rb +1 -24
  26. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  27. data/lib/rubocop/rspec/language.rb +0 -1
  28. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +1 -1
  29. data/lib/rubocop/rspec/version.rb +1 -1
  30. data/lib/rubocop-rspec.rb +1 -17
  31. metadata +4 -67
  32. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +0 -39
  33. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +0 -104
  34. data/lib/rubocop/cop/rspec/capybara/match_style.rb +0 -38
  35. data/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +0 -33
  36. data/lib/rubocop/cop/rspec/capybara/specific_actions.rb +0 -29
  37. data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +0 -24
  38. data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +0 -35
  39. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -36
  40. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +0 -35
  41. data/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +0 -50
  42. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +0 -40
  43. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +0 -29
  44. data/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +0 -33
  45. data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +0 -55
  46. data/lib/rubocop/cop/rspec/file_path.rb +0 -179
  47. data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +0 -27
  48. data/lib/rubocop/cop/rspec/rails/have_http_status.rb +0 -35
  49. data/lib/rubocop/cop/rspec/rails/http_status.rb +0 -61
  50. data/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb +0 -62
  51. data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +0 -39
  52. data/lib/rubocop/cop/rspec/rails/negation_be_valid.rb +0 -39
  53. data/lib/rubocop/cop/rspec/rails/travel_around.rb +0 -34
  54. data/lib/rubocop/rspec/language/node_pattern.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02d59aeeb5798d5e90e8c397e253429236f3a7e179112db482611d4f08fcea3e
4
- data.tar.gz: 2374b303560842bb66b37d7e0020fcaa00d0ec60d83cb506376f82df8af3584d
3
+ metadata.gz: b85afd5fe726f641ba333b9a3ab9ffd2394e21e8fd676c8b50c971a5bb087761
4
+ data.tar.gz: 45ebceb9a51c6a4a8ebaa6233f95f2f722c99227b911badd0316c66402da6480
5
5
  SHA512:
6
- metadata.gz: d55127e8cb4d7370dce4b87139e6341e1838f5ddbb4f0571619b632ed61176a879c693f8366f5c6446bcc333f35059cd6382b71eac013f46b63f8d642b186d5c
7
- data.tar.gz: 4036baa0cda4333da829fa39398434131bd74d93bd0e86cc3322919a7fe1a8d02288473dc087b0508284c3bb15f8496ab9d87e55b0cd9a9875cb513e8ebdea1e
6
+ metadata.gz: e43baa4de2fc4be74218a939d87d8feef61f75c206a06fc004c1ace104efadb271e156c9c0b27adab8d980aac5c9217c2973d28ffc2bf8c077fd3b7dae72fad4
7
+ data.tar.gz: f12f48a9931a2dc00f6af92c55966fff4687c122fbe78e6f8f14b068033727797f023c33da3040180628c78ffd5d3adbfd860f3beffd90b9d556b761e7d24b70
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 3.0.0.pre (2024-06-05)
6
+
7
+ - Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah])
8
+ - Remove `RuboCop::RSpec::Language::NodePattern`. ([@ydah])
9
+ - Remove `RSpec/FilePath` cop. ([@ydah])
10
+ - Remove `RSpec/Capybara/FeatureMethods` cop. If you are using this cop, change it to use `RSpec/Dialect`. ([@ydah])
11
+ - Enable all pending cops. ([@bquorning])
12
+ - Add new `RSpec/MissingExpectationTargetMethod` cop. ([@krororo])
13
+ - Fix an error for `RSpec/ScatteredSetup` when one of the hooks is an empty block. ([@earlopain])
14
+
15
+ Read more about how to upgrade in https://docs.rubocop.org/rubocop-rspec/upgrade_to_version_3.html
16
+
5
17
  ## 2.31.0 (2024-06-07)
6
18
 
7
19
  - Support `AutoCorrect: contextual` option for LSP. ([@ydah])
@@ -893,6 +905,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
893
905
  [@drowze]: https://github.com/Drowze
894
906
  [@dswij]: https://github.com/dswij
895
907
  [@dvandersluis]: https://github.com/dvandersluis
908
+ [@earlopain]: https://github.com/earlopain
896
909
  [@edgibbs]: https://github.com/edgibbs
897
910
  [@eikes]: https://github.com/eikes
898
911
  [@eitoball]: https://github.com/eitoball
@@ -924,6 +937,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
924
937
  [@k-s-a]: https://github.com/K-S-A
925
938
  [@kellysutton]: https://github.com/kellysutton
926
939
  [@koic]: https://github.com/koic
940
+ [@krororo]: https://github.com/krororo
927
941
  [@kuahyeow]: https://github.com/kuahyeow
928
942
  [@lazycoder9]: https://github.com/lazycoder9
929
943
  [@leoarnold]: https://github.com/leoarnold
data/README.md CHANGED
@@ -81,7 +81,7 @@ In your `.rubocop.yml`, you may treat the RSpec cops just like any other
81
81
  cop. For example:
82
82
 
83
83
  ```yaml
84
- RSpec/FilePath:
84
+ RSpec/SpecFilePathFormat:
85
85
  Exclude:
86
86
  - spec/my_poorly_named_spec_file.rb
87
87
  ```
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,7 +146,7 @@ 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
150
  AutoCorrect: contextual
151
151
  VersionAdded: '2.20'
152
152
  VersionChanged: '2.31'
@@ -154,7 +154,7 @@ RSpec/BeEmpty:
154
154
 
155
155
  RSpec/BeEq:
156
156
  Description: Check for expectations where `be(...)` can replace `eq(...)`.
157
- Enabled: pending
157
+ Enabled: true
158
158
  Safe: false
159
159
  VersionAdded: 2.9.0
160
160
  VersionChanged: '2.16'
@@ -170,7 +170,7 @@ RSpec/BeEql:
170
170
 
171
171
  RSpec/BeNil:
172
172
  Description: Ensures a consistent style is used when matching `nil`.
173
- Enabled: pending
173
+ Enabled: true
174
174
  EnforcedStyle: be_nil
175
175
  SupportedStyles:
176
176
  - be
@@ -193,7 +193,7 @@ RSpec/BeforeAfterAll:
193
193
 
194
194
  RSpec/ChangeByZero:
195
195
  Description: Prefer negated matchers over `to change.by(0)`.
196
- Enabled: pending
196
+ Enabled: true
197
197
  VersionAdded: '2.11'
198
198
  VersionChanged: '2.14'
199
199
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero
@@ -202,7 +202,7 @@ RSpec/ChangeByZero:
202
202
  RSpec/ClassCheck:
203
203
  Description: Enforces consistent use of `be_a` or `be_kind_of`.
204
204
  StyleGuide: "#is-a-vs-kind-of"
205
- Enabled: pending
205
+ Enabled: true
206
206
  VersionAdded: '2.13'
207
207
  EnforcedStyle: be_a
208
208
  SupportedStyles:
@@ -212,7 +212,7 @@ RSpec/ClassCheck:
212
212
 
213
213
  RSpec/ContainExactly:
214
214
  Description: Checks where `contain_exactly` is used.
215
- Enabled: pending
215
+ Enabled: true
216
216
  VersionAdded: '2.19'
217
217
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContainExactly
218
218
 
@@ -306,7 +306,7 @@ RSpec/Dialect:
306
306
 
307
307
  RSpec/DuplicatedMetadata:
308
308
  Description: Avoid duplicated metadata.
309
- Enabled: pending
309
+ Enabled: true
310
310
  VersionAdded: '2.16'
311
311
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
312
312
 
@@ -367,7 +367,7 @@ RSpec/EmptyLineAfterSubject:
367
367
 
368
368
  RSpec/EmptyMetadata:
369
369
  Description: Avoid empty metadata hash.
370
- Enabled: pending
370
+ Enabled: true
371
371
  AutoCorrect: contextual
372
372
  VersionAdded: '2.24'
373
373
  VersionChanged: '2.31'
@@ -375,13 +375,13 @@ RSpec/EmptyMetadata:
375
375
 
376
376
  RSpec/EmptyOutput:
377
377
  Description: Check that the `output` matcher is not called with an empty string.
378
- Enabled: pending
378
+ Enabled: true
379
379
  VersionAdded: '2.29'
380
380
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyOutput
381
381
 
382
382
  RSpec/Eq:
383
383
  Description: Use `eq` instead of `be ==` to compare objects.
384
- Enabled: pending
384
+ Enabled: true
385
385
  VersionAdded: '2.24'
386
386
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Eq
387
387
 
@@ -423,7 +423,7 @@ RSpec/ExampleWording:
423
423
 
424
424
  RSpec/ExcessiveDocstringSpacing:
425
425
  Description: Checks for excessive whitespace in example descriptions.
426
- Enabled: pending
426
+ Enabled: true
427
427
  VersionAdded: '2.5'
428
428
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
429
429
 
@@ -456,7 +456,7 @@ RSpec/ExpectInHook:
456
456
 
457
457
  RSpec/ExpectInLet:
458
458
  Description: Do not use `expect` in let.
459
- Enabled: pending
459
+ Enabled: true
460
460
  VersionAdded: '2.30'
461
461
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInLet
462
462
 
@@ -466,21 +466,6 @@ RSpec/ExpectOutput:
466
466
  VersionAdded: '1.10'
467
467
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
468
468
 
469
- RSpec/FilePath:
470
- Description: Checks that spec file paths are consistent and well-formed.
471
- Enabled: true
472
- Include:
473
- - "**/*_spec*rb*"
474
- - "**/spec/**/*"
475
- CustomTransform:
476
- RuboCop: rubocop
477
- RSpec: rspec
478
- IgnoreMethods: false
479
- SpecSuffixOnly: false
480
- VersionAdded: '1.2'
481
- VersionChanged: '2.24'
482
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
483
-
484
469
  RSpec/Focus:
485
470
  Description: Checks if examples are focused.
486
471
  Enabled: true
@@ -511,7 +496,7 @@ RSpec/HooksBeforeExamples:
511
496
 
512
497
  RSpec/IdenticalEqualityAssertion:
513
498
  Description: Checks for equality assertions with identical expressions on both sides.
514
- Enabled: pending
499
+ Enabled: true
515
500
  VersionAdded: '2.4'
516
501
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
517
502
 
@@ -548,7 +533,7 @@ RSpec/ImplicitSubject:
548
533
 
549
534
  RSpec/IndexedLet:
550
535
  Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`).
551
- Enabled: pending
536
+ Enabled: true
552
537
  VersionAdded: '2.20'
553
538
  VersionChanged: '2.23'
554
539
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet
@@ -573,7 +558,7 @@ RSpec/InstanceVariable:
573
558
 
574
559
  RSpec/IsExpectedSpecify:
575
560
  Description: Check for `specify` with `is_expected` and one-liner expectations.
576
- Enabled: pending
561
+ Enabled: true
577
562
  VersionAdded: '2.27'
578
563
  StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
579
564
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
@@ -625,7 +610,7 @@ RSpec/LetSetup:
625
610
 
626
611
  RSpec/MatchArray:
627
612
  Description: Checks where `match_array` is used.
628
- Enabled: pending
613
+ Enabled: true
629
614
  VersionAdded: '2.19'
630
615
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MatchArray
631
616
 
@@ -658,7 +643,7 @@ RSpec/MessageSpies:
658
643
 
659
644
  RSpec/MetadataStyle:
660
645
  Description: Use consistent metadata style.
661
- Enabled: pending
646
+ Enabled: true
662
647
  EnforcedStyle: symbol
663
648
  SupportedStyles:
664
649
  - hash
@@ -672,6 +657,12 @@ RSpec/MissingExampleGroupArgument:
672
657
  VersionAdded: '1.28'
673
658
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
674
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
+
675
666
  RSpec/MultipleDescribes:
676
667
  Description: Checks for multiple top-level example groups.
677
668
  Enabled: true
@@ -726,7 +717,7 @@ RSpec/NestedGroups:
726
717
 
727
718
  RSpec/NoExpectationExample:
728
719
  Description: Checks if an example contains any expectation.
729
- Enabled: pending
720
+ Enabled: true
730
721
  Safe: false
731
722
  VersionAdded: '2.13'
732
723
  VersionChanged: '2.14'
@@ -759,7 +750,7 @@ RSpec/Pending:
759
750
 
760
751
  RSpec/PendingWithoutReason:
761
752
  Description: Checks for pending or skipped examples without reason.
762
- Enabled: pending
753
+ Enabled: true
763
754
  VersionAdded: '2.16'
764
755
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
765
756
 
@@ -785,7 +776,7 @@ RSpec/ReceiveCounts:
785
776
 
786
777
  RSpec/ReceiveMessages:
787
778
  Description: Checks for multiple messages stubbed on the same object.
788
- Enabled: pending
779
+ Enabled: true
789
780
  SafeAutoCorrect: false
790
781
  VersionAdded: '2.23'
791
782
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
@@ -798,19 +789,19 @@ RSpec/ReceiveNever:
798
789
 
799
790
  RSpec/RedundantAround:
800
791
  Description: Remove redundant `around` hook.
801
- Enabled: pending
792
+ Enabled: true
802
793
  VersionAdded: '2.19'
803
794
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
804
795
 
805
796
  RSpec/RedundantPredicateMatcher:
806
797
  Description: Checks for redundant predicate matcher.
807
- Enabled: pending
798
+ Enabled: true
808
799
  VersionAdded: '2.26'
809
800
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
810
801
 
811
802
  RSpec/RemoveConst:
812
803
  Description: Checks that `remove_const` is not used in specs.
813
- Enabled: pending
804
+ Enabled: true
814
805
  VersionAdded: '2.26'
815
806
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
816
807
 
@@ -846,7 +837,7 @@ RSpec/RepeatedIncludeExample:
846
837
 
847
838
  RSpec/RepeatedSubjectCall:
848
839
  Description: Checks for repeated calls to subject missing that it is memoized.
849
- Enabled: pending
840
+ Enabled: true
850
841
  VersionAdded: '2.27'
851
842
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
852
843
 
@@ -903,19 +894,19 @@ RSpec/SingleArgumentMessageChain:
903
894
 
904
895
  RSpec/SkipBlockInsideExample:
905
896
  Description: Checks for passing a block to `skip` within examples.
906
- Enabled: pending
897
+ Enabled: true
907
898
  VersionAdded: '2.19'
908
899
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SkipBlockInsideExample
909
900
 
910
901
  RSpec/SortMetadata:
911
902
  Description: Sort RSpec metadata alphabetically.
912
- Enabled: pending
903
+ Enabled: true
913
904
  VersionAdded: '2.14'
914
905
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata
915
906
 
916
907
  RSpec/SpecFilePathFormat:
917
908
  Description: Checks that spec file paths are consistent and well-formed.
918
- Enabled: pending
909
+ Enabled: true
919
910
  Include:
920
911
  - "**/*_spec.rb"
921
912
  Exclude:
@@ -931,7 +922,7 @@ RSpec/SpecFilePathFormat:
931
922
 
932
923
  RSpec/SpecFilePathSuffix:
933
924
  Description: Checks that spec file paths suffix are consistent and well-formed.
934
- Enabled: pending
925
+ Enabled: true
935
926
  VersionAdded: '2.24'
936
927
  Include:
937
928
  - "**/*_spec*rb*"
@@ -946,7 +937,7 @@ RSpec/StubbedMock:
946
937
 
947
938
  RSpec/SubjectDeclaration:
948
939
  Description: Ensure that subject is defined using subject helper.
949
- Enabled: pending
940
+ Enabled: true
950
941
  VersionAdded: '2.5'
951
942
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
952
943
 
@@ -960,7 +951,7 @@ RSpec/SubjectStub:
960
951
 
961
952
  RSpec/UndescriptiveLiteralsDescription:
962
953
  Description: Description should be descriptive.
963
- Enabled: pending
954
+ Enabled: true
964
955
  VersionAdded: '2.29'
965
956
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UndescriptiveLiteralsDescription
966
957
 
@@ -994,7 +985,7 @@ RSpec/VariableName:
994
985
 
995
986
  RSpec/VerifiedDoubleReference:
996
987
  Description: Checks for consistent verified double reference style.
997
- Enabled: pending
988
+ Enabled: true
998
989
  SafeAutoCorrect: false
999
990
  EnforcedStyle: constant
1000
991
  SupportedStyles:
@@ -1025,216 +1016,3 @@ RSpec/Yield:
1025
1016
  Enabled: true
1026
1017
  VersionAdded: '1.32'
1027
1018
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
1028
-
1029
- RSpec/Capybara:
1030
- Enabled: true
1031
- Include: *1
1032
- Language: *2
1033
-
1034
- RSpec/Capybara/CurrentPathExpectation:
1035
- Description: Checks that no expectations are set on Capybara's `current_path`.
1036
- Enabled: true
1037
- VersionAdded: '1.18'
1038
- VersionChanged: '2.0'
1039
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
1040
-
1041
- RSpec/Capybara/FeatureMethods:
1042
- Description: Checks for consistent method usage in feature specs.
1043
- Enabled: true
1044
- EnabledMethods: []
1045
- VersionAdded: '1.17'
1046
- VersionChanged: '2.0'
1047
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
1048
-
1049
- RSpec/Capybara/MatchStyle:
1050
- Description: Checks for usage of deprecated style methods.
1051
- Enabled: pending
1052
- VersionAdded: '2.17'
1053
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle
1054
-
1055
- RSpec/Capybara/NegationMatcher:
1056
- Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
1057
- Enabled: pending
1058
- VersionAdded: '2.14'
1059
- EnforcedStyle: not_to
1060
- SupportedStyles:
1061
- - have_no
1062
- - not_to
1063
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher
1064
-
1065
- RSpec/Capybara/SpecificActions:
1066
- Description: Checks for there is a more specific actions offered by Capybara.
1067
- Enabled: pending
1068
- VersionAdded: '2.14'
1069
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions
1070
-
1071
- RSpec/Capybara/SpecificFinders:
1072
- Description: Checks if there is a more specific finder offered by Capybara.
1073
- Enabled: pending
1074
- VersionAdded: '2.13'
1075
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders
1076
-
1077
- RSpec/Capybara/SpecificMatcher:
1078
- Description: Checks for there is a more specific matcher offered by Capybara.
1079
- Enabled: pending
1080
- VersionAdded: '2.12'
1081
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher
1082
-
1083
- RSpec/Capybara/VisibilityMatcher:
1084
- Description: Checks for boolean visibility in Capybara finders.
1085
- Enabled: true
1086
- VersionAdded: '1.39'
1087
- VersionChanged: '2.0'
1088
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
1089
-
1090
- RSpec/FactoryBot:
1091
- Enabled: true
1092
- Include: *1
1093
- Language: *2
1094
-
1095
- RSpec/FactoryBot/AttributeDefinedStatically:
1096
- Description: Always declare attribute values as blocks.
1097
- Enabled: true
1098
- Include:
1099
- - "**/spec/factories.rb"
1100
- - "**/spec/factories/**/*.rb"
1101
- - "**/features/support/factories/**/*.rb"
1102
- VersionAdded: '1.28'
1103
- VersionChanged: '2.23'
1104
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
1105
-
1106
- RSpec/FactoryBot/ConsistentParenthesesStyle:
1107
- Description: Use a consistent style for parentheses in factory bot calls.
1108
- Enabled: pending
1109
- EnforcedStyle: require_parentheses
1110
- SupportedStyles:
1111
- - require_parentheses
1112
- - omit_parentheses
1113
- VersionAdded: '2.14'
1114
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle
1115
-
1116
- RSpec/FactoryBot/CreateList:
1117
- Description: Checks for create_list usage.
1118
- Enabled: true
1119
- Include:
1120
- - "**/*_spec.rb"
1121
- - "**/spec/**/*"
1122
- - "**/spec/factories.rb"
1123
- - "**/spec/factories/**/*.rb"
1124
- - "**/features/support/factories/**/*.rb"
1125
- EnforcedStyle: create_list
1126
- SupportedStyles:
1127
- - create_list
1128
- - n_times
1129
- VersionAdded: '1.25'
1130
- VersionChanged: '2.23'
1131
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
1132
-
1133
- RSpec/FactoryBot/FactoryClassName:
1134
- Description: Use string value when setting the class attribute explicitly.
1135
- Enabled: true
1136
- Include:
1137
- - "**/spec/factories.rb"
1138
- - "**/spec/factories/**/*.rb"
1139
- - "**/features/support/factories/**/*.rb"
1140
- VersionAdded: '1.37'
1141
- VersionChanged: '2.23'
1142
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
1143
-
1144
- RSpec/FactoryBot/FactoryNameStyle:
1145
- Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
1146
- Enabled: pending
1147
- VersionAdded: '2.16'
1148
- EnforcedStyle: symbol
1149
- SupportedStyles:
1150
- - symbol
1151
- - string
1152
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
1153
-
1154
- RSpec/FactoryBot/SyntaxMethods:
1155
- Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
1156
- Enabled: pending
1157
- SafeAutoCorrect: false
1158
- VersionAdded: '2.7'
1159
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
1160
-
1161
- RSpec/Rails:
1162
- Enabled: true
1163
- Include: *1
1164
- Language: *2
1165
-
1166
- RSpec/Rails/AvoidSetupHook:
1167
- Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
1168
- Enabled: pending
1169
- VersionAdded: '2.4'
1170
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
1171
-
1172
- RSpec/Rails/HaveHttpStatus:
1173
- Description: Checks that tests use `have_http_status` instead of equality matchers.
1174
- Enabled: pending
1175
- ResponseMethods:
1176
- - response
1177
- - last_response
1178
- SafeAutoCorrect: false
1179
- VersionAdded: '2.12'
1180
- VersionChanged: '2.27'
1181
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
1182
-
1183
- RSpec/Rails/HttpStatus:
1184
- Description: Enforces use of symbolic or numeric value to describe HTTP status.
1185
- Enabled: true
1186
- EnforcedStyle: symbolic
1187
- SupportedStyles:
1188
- - numeric
1189
- - symbolic
1190
- - be_status
1191
- VersionAdded: '1.23'
1192
- VersionChanged: '2.20'
1193
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
1194
-
1195
- RSpec/Rails/InferredSpecType:
1196
- Description: Identifies redundant spec type.
1197
- Enabled: pending
1198
- Safe: false
1199
- VersionAdded: '2.14'
1200
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType
1201
- Inferences:
1202
- channels: channel
1203
- controllers: controller
1204
- features: feature
1205
- generator: generator
1206
- helpers: helper
1207
- jobs: job
1208
- mailboxes: mailbox
1209
- mailers: mailer
1210
- models: model
1211
- requests: request
1212
- integration: request
1213
- api: request
1214
- routing: routing
1215
- system: system
1216
- views: view
1217
-
1218
- RSpec/Rails/MinitestAssertions:
1219
- Description: Check if using Minitest-like matchers.
1220
- Enabled: pending
1221
- VersionAdded: '2.17'
1222
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
1223
-
1224
- RSpec/Rails/NegationBeValid:
1225
- Description: Enforces use of `be_invalid` or `not_to` for negated be_valid.
1226
- Safe: false
1227
- EnforcedStyle: not_to
1228
- SupportedStyles:
1229
- - not_to
1230
- - be_invalid
1231
- Enabled: pending
1232
- VersionAdded: '2.23'
1233
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/NegationBeValid
1234
-
1235
- RSpec/Rails/TravelAround:
1236
- Description: Prefer to travel in `before` rather than `around`.
1237
- Enabled: pending
1238
- Safe: false
1239
- VersionAdded: '2.19'
1240
- Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround
@@ -34,3 +34,14 @@ renamed:
34
34
  RSpec/Rails/MinitestAssertions: RSpecRails/MinitestAssertions
35
35
  RSpec/Rails/NegationBeValid: RSpecRails/NegationBeValid
36
36
  RSpec/Rails/TravelAround: RSpecRails/TravelAround
37
+
38
+ split:
39
+ RSpec/FilePath:
40
+ alternatives:
41
+ - RSpec/SpecFilePathFormat
42
+ - RSpec/SpecFilePathSuffix
43
+
44
+ removed:
45
+ RSpec/Capybara/FeatureMethods:
46
+ reason: >
47
+ this cop has migrated to `RSpec/Dialect`. Please use `RSpec/Dialect` instead
@@ -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
 
@@ -29,6 +29,19 @@ module RuboCop
29
29
  # PreferredMethods:
30
30
  # context: describe
31
31
  #
32
+ # If you were previously using the `RSpec/Capybara/FeatureMethods` cop and
33
+ # want to keep disabling all Capybara-specific methods that have the same
34
+ # native RSpec method (e.g. are just aliases), use the following config:
35
+ #
36
+ # RSpec/Dialect:
37
+ # PreferredMethods:
38
+ # background: :before
39
+ # scenario: :it
40
+ # xscenario: :xit
41
+ # given: :let
42
+ # given!: :let!
43
+ # feature: :describe
44
+ #
32
45
  # You can expect the following behavior:
33
46
  #
34
47
  # @example
@@ -97,7 +97,7 @@ module RuboCop
97
97
 
98
98
  def complex_literal?(node)
99
99
  COMPLEX_LITERALS.include?(node.type) &&
100
- node.each_child_node.all?(&method(:literal?))
100
+ node.each_child_node.all? { |child_node| literal?(child_node) }
101
101
  end
102
102
  end
103
103
  end
@@ -27,7 +27,7 @@ module RuboCop
27
27
  # @!method expectation(node)
28
28
  def_node_search :expectation, '(send nil? #Expectations.all ...)'
29
29
 
30
- def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
30
+ def on_block(node)
31
31
  return unless hook?(node)
32
32
  return if node.body.nil?
33
33
 
@@ -22,7 +22,7 @@ module RuboCop
22
22
  # @!method expectation(node)
23
23
  def_node_search :expectation, '(send nil? #Expectations.all ...)'
24
24
 
25
- def on_block(node)
25
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
26
26
  return unless let?(node)
27
27
  return if node.body.nil?
28
28
 
@@ -31,8 +31,6 @@ module RuboCop
31
31
  end
32
32
  end
33
33
 
34
- alias on_numblock on_block
35
-
36
34
  private
37
35
 
38
36
  def message(expect)
@@ -119,7 +119,7 @@ module RuboCop
119
119
  private
120
120
 
121
121
  def inside_describe_block?(node)
122
- node.each_ancestor(:block).any?(&method(:spec_group?))
122
+ node.each_ancestor(:block).any? { |ancestor| spec_group?(ancestor) }
123
123
  end
124
124
  end
125
125
  end