rubocop-rspec 2.22.0 → 3.4.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +193 -11
  3. data/README.md +15 -2
  4. data/config/default.yml +161 -249
  5. data/config/obsoletion.yml +20 -14
  6. data/lib/rubocop/cop/rspec/around_block.rb +5 -7
  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 +34 -7
  15. data/lib/rubocop/cop/rspec/contain_exactly.rb +1 -0
  16. data/lib/rubocop/cop/rspec/context_method.rb +2 -2
  17. data/lib/rubocop/cop/rspec/context_wording.rb +16 -10
  18. data/lib/rubocop/cop/rspec/describe_symbol.rb +1 -1
  19. data/lib/rubocop/cop/rspec/described_class.rb +33 -11
  20. data/lib/rubocop/cop/rspec/dialect.rb +13 -0
  21. data/lib/rubocop/cop/rspec/duplicated_metadata.rb +1 -1
  22. data/lib/rubocop/cop/rspec/empty_example_group.rb +6 -1
  23. data/lib/rubocop/cop/rspec/empty_hook.rb +1 -1
  24. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +2 -2
  25. data/lib/rubocop/cop/rspec/empty_metadata.rb +47 -0
  26. data/lib/rubocop/cop/rspec/empty_output.rb +47 -0
  27. data/lib/rubocop/cop/rspec/eq.rb +47 -0
  28. data/lib/rubocop/cop/rspec/example_length.rb +11 -5
  29. data/lib/rubocop/cop/rspec/example_without_description.rb +11 -2
  30. data/lib/rubocop/cop/rspec/example_wording.rb +12 -3
  31. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +14 -5
  32. data/lib/rubocop/cop/rspec/expect_actual.rb +18 -15
  33. data/lib/rubocop/cop/rspec/expect_change.rb +2 -2
  34. data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
  35. data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
  36. data/lib/rubocop/cop/rspec/expect_output.rb +1 -4
  37. data/lib/rubocop/cop/rspec/focus.rb +13 -4
  38. data/lib/rubocop/cop/rspec/hook_argument.rb +2 -2
  39. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +1 -1
  40. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +2 -2
  41. data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -1
  42. data/lib/rubocop/cop/rspec/implicit_subject.rb +2 -2
  43. data/lib/rubocop/cop/rspec/indexed_let.rb +36 -4
  44. data/lib/rubocop/cop/rspec/instance_spy.rb +2 -2
  45. data/lib/rubocop/cop/rspec/instance_variable.rb +4 -4
  46. data/lib/rubocop/cop/rspec/is_expected_specify.rb +45 -0
  47. data/lib/rubocop/cop/rspec/iterated_expectation.rb +3 -3
  48. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +2 -2
  49. data/lib/rubocop/cop/rspec/let_before_examples.rb +5 -1
  50. data/lib/rubocop/cop/rspec/let_setup.rb +1 -1
  51. data/lib/rubocop/cop/rspec/match_array.rb +1 -0
  52. data/lib/rubocop/cop/rspec/message_expectation.rb +1 -2
  53. data/lib/rubocop/cop/rspec/message_spies.rb +0 -2
  54. data/lib/rubocop/cop/rspec/metadata_style.rb +197 -0
  55. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  56. data/lib/rubocop/cop/rspec/mixin/file_help.rb +14 -0
  57. data/lib/rubocop/cop/rspec/mixin/metadata.rb +18 -7
  58. data/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb +2 -2
  59. data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +7 -0
  60. data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
  61. data/lib/rubocop/cop/rspec/multiple_expectations.rb +18 -13
  62. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +4 -5
  63. data/lib/rubocop/cop/rspec/named_subject.rb +6 -3
  64. data/lib/rubocop/cop/rspec/nested_groups.rb +2 -1
  65. data/lib/rubocop/cop/rspec/pending.rb +12 -2
  66. data/lib/rubocop/cop/rspec/pending_without_reason.rb +1 -6
  67. data/lib/rubocop/cop/rspec/predicate_matcher.rb +17 -13
  68. data/lib/rubocop/cop/rspec/receive_counts.rb +1 -1
  69. data/lib/rubocop/cop/rspec/receive_messages.rb +161 -0
  70. data/lib/rubocop/cop/rspec/redundant_predicate_matcher.rb +67 -0
  71. data/lib/rubocop/cop/rspec/remove_const.rb +39 -0
  72. data/lib/rubocop/cop/rspec/repeated_example.rb +6 -6
  73. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +1 -1
  74. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +2 -2
  75. data/lib/rubocop/cop/rspec/repeated_include_example.rb +1 -1
  76. data/lib/rubocop/cop/rspec/repeated_subject_call.rb +125 -0
  77. data/lib/rubocop/cop/rspec/return_from_stub.rb +1 -1
  78. data/lib/rubocop/cop/rspec/scattered_setup.rb +7 -1
  79. data/lib/rubocop/cop/rspec/shared_context.rb +1 -1
  80. data/lib/rubocop/cop/rspec/shared_examples.rb +66 -20
  81. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +5 -7
  82. data/lib/rubocop/cop/rspec/sort_metadata.rb +23 -8
  83. data/lib/rubocop/cop/rspec/spec_file_path_format.rb +133 -0
  84. data/lib/rubocop/cop/rspec/spec_file_path_suffix.rb +40 -0
  85. data/lib/rubocop/cop/rspec/stubbed_mock.rb +16 -11
  86. data/lib/rubocop/cop/rspec/subject_stub.rb +6 -6
  87. data/lib/rubocop/cop/rspec/undescriptive_literals_description.rb +69 -0
  88. data/lib/rubocop/cop/rspec/unspecified_exception.rb +21 -14
  89. data/lib/rubocop/cop/rspec/variable_definition.rb +4 -4
  90. data/lib/rubocop/cop/rspec/verified_double_reference.rb +15 -54
  91. data/lib/rubocop/cop/rspec/verified_doubles.rb +2 -2
  92. data/lib/rubocop/cop/rspec/void_expect.rb +10 -4
  93. data/lib/rubocop/cop/rspec_cops.rb +14 -28
  94. data/lib/rubocop/rspec/concept.rb +0 -1
  95. data/lib/rubocop/rspec/config_formatter.rb +1 -17
  96. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  97. data/lib/rubocop/rspec/description_extractor.rb +2 -2
  98. data/lib/rubocop/rspec/hook.rb +1 -1
  99. data/lib/rubocop/rspec/language.rb +8 -9
  100. data/lib/rubocop/rspec/node.rb +1 -1
  101. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +1 -1
  102. data/lib/rubocop/rspec/version.rb +1 -1
  103. data/lib/rubocop/rspec/wording.rb +9 -1
  104. data/lib/rubocop-rspec.rb +2 -14
  105. metadata +24 -61
  106. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +0 -39
  107. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +0 -104
  108. data/lib/rubocop/cop/rspec/capybara/match_style.rb +0 -38
  109. data/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +0 -33
  110. data/lib/rubocop/cop/rspec/capybara/specific_actions.rb +0 -29
  111. data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +0 -24
  112. data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +0 -35
  113. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -36
  114. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +0 -35
  115. data/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +0 -50
  116. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +0 -40
  117. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +0 -29
  118. data/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +0 -33
  119. data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +0 -55
  120. data/lib/rubocop/cop/rspec/file_path.rb +0 -173
  121. data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +0 -43
  122. data/lib/rubocop/cop/rspec/rails/have_http_status.rb +0 -55
  123. data/lib/rubocop/cop/rspec/rails/http_status.rb +0 -203
  124. data/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb +0 -145
  125. data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +0 -60
  126. data/lib/rubocop/cop/rspec/rails/travel_around.rb +0 -92
  127. 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: e786386e218833ac7f78af9ffcadadb6bf6c822a31b455cac1567152fd3bc9c0
4
- data.tar.gz: 384170b4ae3a06c05b30855ae9361057c53226b40b924d4ec1d49c0d15195658
3
+ metadata.gz: 4a2433cc3212de48725bca4fa2f8216ef0742950d1b0ad0a52e0d717050ede4e
4
+ data.tar.gz: 3e43165a772275ece7344813b6dfc5196669763013c0bedc3b75107cf6fa0f30
5
5
  SHA512:
6
- metadata.gz: 554345811f404b27a39fd522e0085022c39147e0487f04ea77ed7887002451af112e2ddc45ad94841c0a4201a76f37fbfb7a2e64aed3c7efa91cddf1a30843bc
7
- data.tar.gz: 22882a56ddf03c55d6eaf299fb05197c835049054231e6d7798e2ca3eac5cbd9840eeada823a12431b00efd37289a8353792dfe3c8f653b2606f9ccda480615a
6
+ metadata.gz: 41a9171c098150e3349977cd08df5f369fe2d33c0bb4f1b29edcfb2633eae2c880ab1ff71a9c4a1ee5dc28645a6359ecd3e4ab99a822ac576523386e78364ee2
7
+ data.tar.gz: af1c164ac3d8c9e9ed61611fa9877c459656f695fd45c057c776af99304fcd8471fa00d958d7bf650ba46f82056ae96accd12cfeec17eb1a00129baffdb51768
data/CHANGELOG.md CHANGED
@@ -2,6 +2,166 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 3.4.0 (2025-01-20)
6
+
7
+ - Fix `RSpec/SortMetadata` cop to limit sorting to trailing metadata arguments. ([@cbliard])
8
+ - Replace `RSpec/StringAsInstanceDoubleConstant` with `RSpec/VerifiedDoubleReference` configured to only support constant class references. ([@corsonknowles])
9
+ - Fix `RSpec/EmptyExampleGroup` cop false positive when a simple conditional is used inside an iterator. ([@lovro-bikic])
10
+
11
+ ## 3.3.0 (2024-12-12)
12
+
13
+ - Deprecate `top_level_group?` method from `TopLevelGroup` mixin as all of its callers were intentionally removed from `Rubocop/RSpec`. ([@corsonknowles])
14
+ - Fix false positive for RSpec/EmptyMetadata for splat kwargs. ([@pirj])
15
+
16
+ ## 3.2.0 (2024-10-26)
17
+
18
+ - Fix `RSpec/VoidExpect` to only operate inside an example block. ([@corsonknowles])
19
+ - Change `RSpec/ContextWording` cop to always report an offense when both `Prefixes` and `AllowedPatterns` are empty. ([@ydah])
20
+ - Add support for `and` and `or` compound matchers to `RSpec/ChangeByZero` cop. ([@ydah])
21
+
22
+ ## 3.1.0 (2024-10-01)
23
+
24
+ - Add `RSpec/StringAsInstanceDoubleConstant` to check for and correct strings used as instance_doubles. ([@corsonknowles])
25
+ - Fix false-positive for `RSpec/UnspecifiedException` when a method is literally named `raise_exception`. ([@aarestad])
26
+ - Fix false-positive for `RSpec/UnspecifiedException` when `not_to raise_error` is used within a block. ([@aarestad], [@G-Rath])
27
+
28
+ ## 3.0.5 (2024-09-07)
29
+
30
+ - Fix false-negative and error for `RSpec/MetadataStyle` when non-literal args are used in metadata in `EnforceStyle: hash`. ([@cbliard])
31
+ - Improve offense message for `RSpec/IndexedLet`. ([@earlopain])
32
+
33
+ ## 3.0.4 (2024-08-05)
34
+
35
+ - Fix false-negative for `UnspecifiedException` when matcher is chained. ([@r7kamura])
36
+
37
+ ## 3.0.3 (2024-07-12)
38
+
39
+ - Add support for Unicode RIGHT SINGLE QUOTATION MARK in `RSpec/ExampleWording`. ([@jdufresne])
40
+ - Suppress deprecation warning for `RSpec/MultipleExpectations`, `RSpec/MultipleMemoizedHelpers`, and `RSpec/NestedGroups` cops. ([@koic])
41
+
42
+ ## 3.0.2 (2024-07-02)
43
+
44
+ - Fix wrong autocorrect for `RSpec/ScatteredSetup` when hook contains heredoc. ([@earlopain])
45
+ - Fix false negative for `RSpec/PredicateMatcher` when expectation contains custom failure message. ([@earlopain])
46
+ - Facilitate the 3.0 upgrade flow with proper extracted cop messages. ([@jeppester])
47
+
48
+ ## 3.0.1 (2024-06-11)
49
+
50
+ - Bump RuboCop requirement to +1.61. ([@ydah])
51
+
52
+ ## 3.0.0 (2024-06-11)
53
+
54
+ - Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah])
55
+ - Remove `RuboCop::RSpec::Language::NodePattern`. ([@ydah])
56
+ - Remove `RSpec/FilePath` cop. ([@ydah])
57
+ - Remove `RSpec/Capybara/FeatureMethods` cop. If you are using this cop, change it to use `RSpec/Dialect`. ([@ydah])
58
+ - Add new `RSpec/MissingExpectationTargetMethod` cop. ([@krororo])
59
+ - Fix an error for `RSpec/ScatteredSetup` when one of the hooks is an empty block. ([@earlopain])
60
+
61
+ These previously pending cops are now enabled by default: `RSpec/BeEmpty`, `RSpec/BeEq`, `RSpec/BeNil`, `RSpec/ChangeByZero`, `RSpec/ClassCheck`, `RSpec/ContainExactly`, `RSpec/DuplicatedMetadata`, `RSpec/EmptyMetadata`, `RSpec/EmptyOutput`, `RSpec/Eq`, `RSpec/ExcessiveDocstringSpacing`, `RSpec/ExpectInLet`, `RSpec/IdenticalEqualityAssertion`, `RSpec/IndexedLet`, `RSpec/IsExpectedSpecify`, `RSpec/MatchArray`, `RSpec/MetadataStyle`, `RSpec/NoExpectationExample`, `RSpec/PendingWithoutReason`, `RSpec/ReceiveMessages`, `RSpec/RedundantAround`, `RSpec/RedundantPredicateMatcher`, `RSpec/RemoveConst`, `RSpec/RepeatedSubjectCall`, `RSpec/SkipBlockInsideExample`, `RSpec/SortMetadata`, `RSpec/SpecFilePathFormat`, `RSpec/SpecFilePathSuffix`, `RSpec/SubjectDeclaration`, `RSpec/UndescriptiveLiteralsDescription`, and `RSpec/VerifiedDoubleReference`.
62
+
63
+ Read more about how to upgrade in https://docs.rubocop.org/rubocop-rspec/upgrade_to_version_3.html
64
+
65
+ ## 2.31.0 (2024-06-07)
66
+
67
+ - Support `AutoCorrect: contextual` option for LSP. ([@ydah])
68
+
69
+ ## 2.30.0 (2024-06-03)
70
+
71
+ - Add new `RSpec/ExpectInLet` cop. ([@yasu551])
72
+
73
+ ## 2.29.2 (2024-05-02)
74
+
75
+ - Fix beginless and endless range bug for RepeatedIncludeExample cop. ([@hasghari])
76
+ - Fix a false positive for `RSpec/RepeatedSubjectCall` when subject is used as argument to function call. ([@K-S-A])
77
+
78
+ ## 2.29.1 (2024-04-05)
79
+
80
+ - Fix an error in the default configuration. ([@ydah])
81
+
82
+ ## 2.29.0 (2024-04-04)
83
+
84
+ - Fix an autocorrect error for `RSpec/ExpectActual`. ([@bquorning])
85
+ - Add new `RSpec/UndescriptiveLiteralsDescription` cop. ([@ydah])
86
+ - Add new `RSpec/EmptyOutput` cop. ([@bquorning])
87
+
88
+ ## 2.28.0 (2024-03-30)
89
+
90
+ - Extract RSpec Rails cops to a separate repository, [`rubocop-rspec_rails`](https://github.com/rubocop/rubocop-rspec_rails). The `rubocop-rspec_rails` repository is a dependency of `rubocop-rspec` and the cops related to rspec-rails are aliased (`RSpec/Rails/Foo` == `RSpecRails/Foo`) until v3.0 is released, so the change will be invisible to users until then. ([@ydah])
91
+
92
+ ## 2.27.1 (2024-03-03)
93
+
94
+ - Fix a false positive for `RSpec/RepeatedSubjectCall` when `subject.method_call`. ([@ydah])
95
+ - Add configuration option `OnlyStaticConstants` to `RSpec/DescribedClass`. ([@ydah])
96
+
97
+ ## 2.27.0 (2024-03-01)
98
+
99
+ - Add new `RSpec/IsExpectedSpecify` cop. ([@ydah])
100
+ - Add new `RSpec/RepeatedSubjectCall` cop. ([@drcapulet])
101
+ - Add support for `assert_true`, `assert_false`, `assert_not_equal`, `assert_not_nil`, `*_empty`, `*_predicate`, `*_kind_of`, `*_in_delta`, `*_match`, `*_instance_of` and `*_includes` assertions in `RSpec/Rails/MinitestAssertions`. ([@ydah], [@G-Rath])
102
+ - Support asserts with messages in `RSpec/BeEmpty`. ([@G-Rath])
103
+ - Fix a false positive for `RSpec/ExpectActual` when used with rspec-rails routing matchers. ([@naveg])
104
+ - Add configuration option `ResponseMethods` to `RSpec/Rails/HaveHttpStatus`. ([@ydah])
105
+ - Fix a false negative for `RSpec/DescribedClass` when class with constant. ([@ydah])
106
+ - Fix a false positive for `RSpec/ExampleWithoutDescription` when `specify` with multi-line block and missing description. ([@ydah])
107
+ - Fix an incorrect autocorrect for `RSpec/ChangeByZero` when compound expectations with line break before `.by(0)`. ([@ydah])
108
+
109
+ ## 2.26.1 (2024-01-05)
110
+
111
+ - Fix an error for `RSpec/SharedExamples` when using examples without argument. ([@ydah])
112
+
113
+ ## 2.26.0 (2024-01-04)
114
+
115
+ - Add new `RSpec/RedundantPredicateMatcher` cop. ([@ydah])
116
+ - Add new `RSpec/RemoveConst` cop. ([@swelther])
117
+ - Add support for correcting "it will" (future tense) for `RSpec/ExampleWording`. ([@jdufresne])
118
+ - Add support for `symbol` style for `RSpec/SharedExamples`. ([@jessieay])
119
+ - Ensure `PendingWithoutReason` can detect violations inside shared groups. ([@robinaugh])
120
+
121
+ ## 2.25.0 (2023-10-27)
122
+
123
+ - Add support single quoted string and percent string and heredoc for `RSpec/Rails/HttpStatus`. ([@ydah])
124
+ - Change to be inline disable for `RSpec/SpecFilePathFormat` like `RSpec/FilePath`. ([@ydah])
125
+ - Fix a false positive for `RSpec/MetadataStyle` with example groups having multiple string arguments. ([@franzliedke])
126
+
127
+ ## 2.24.1 (2023-09-23)
128
+
129
+ - Fix an error when using `RSpec/FilePath` and revert to enabled by default. If you have already moved to `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`, disable `RSpec/FilePath` explicitly as `Enabled: false`. The `RSpec/FilePath` before migration and the `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat` as the target are available respectively. ([@ydah])
130
+
131
+ ## 2.24.0 (2023-09-08)
132
+
133
+ - Split `RSpec/FilePath` into `RSpec/SpecFilePathSuffix` and `RSpec/SpecFilePathFormat`. `RSpec/FilePath` cop is disabled by default and the two new cops are pending and need to be enabled explicitly. ([@ydah])
134
+ - Add new `RSpec/Eq` cop. ([@ydah])
135
+ - Add `RSpec/MetadataStyle` and `RSpec/EmptyMetadata` cops. ([@r7kamura])
136
+ - Add support `RSpec/Rails/HttpStatus` when `have_http_status` with string argument. ([@ydah])
137
+ - Fix an infinite loop error when `RSpec/ExcessiveDocstringSpacing` finds a description with non-ASCII leading/trailing whitespace. ([@bcgraham])
138
+ - Fix an incorrect autocorrect for `RSpec/ReceiveMessages` when return values declared between stubs. ([@marocchino])
139
+ - Fix a false positive `RSpec/Focus` when chained method call and inside define method. ([@ydah])
140
+
141
+ ## 2.23.2 (2023-08-09)
142
+
143
+ - Fix an incorrect autocorrect for `RSpec/ReceiveMessages` when method is only non-word character. ([@marocchino])
144
+ - Fix a false positive for `RSpec/ReceiveMessages` when return with splat. ([@marocchino])
145
+
146
+ ## 2.23.1 (2023-08-07)
147
+
148
+ - Mark to `Safe: false` for `RSpec/Rails/NegationBeValid` cop. ([@ydah])
149
+ - Declare autocorrect as unsafe for `RSpec/ReceiveMessages`. ([@bquorning])
150
+
151
+ ## 2.23.0 (2023-07-30)
152
+
153
+ - Add new `RSpec/Rails/NegationBeValid` cop. ([@ydah])
154
+ - Fix a false negative for `RSpec/ExcessiveDocstringSpacing` when finds description with em space. ([@ydah])
155
+ - Fix a false positive for `RSpec/EmptyExampleGroup` when example group with examples defined in `if` branch inside iterator. ([@ydah])
156
+ - Update the message output of `RSpec/ExpectActual` to include the word 'value'. ([@corydiamand])
157
+ - Fix a false negative for `RSpec/Pending` when `it` without body. ([@ydah])
158
+ - Add new `RSpec/ReceiveMessages` cop. ([@ydah])
159
+ - Change default.yml path to use `**/spec/*` instead of `spec/*`. ([@ydah])
160
+ - Add `AllowedIdentifiers` and `AllowedPatterns` configuration option to `RSpec/IndexedLet`. ([@ydah])
161
+ - Fix `RSpec/NamedSubject` when block has no body. ([@splattael])
162
+ - Fix `RSpec/LetBeforeExamples` autocorrect incompatible with `RSpec/ScatteredLet` autocorrect. ([@ydah])
163
+ - Update `RSpec/Focus` to support `shared_context` and `shared_examples`. ([@tmaier])
164
+
5
165
  ## 2.22.0 (2023-05-06)
6
166
 
7
167
  - Extract factory_bot cops to a separate repository, [`rubocop-factory_bot`](https://github.com/rubocop/rubocop-factory_bot). The `rubocop-factory_bot` repository is a dependency of `rubocop-rspec` and the factory_bot cops are aliased (`RSpec/FactoryBot/Foo` == `FactoryBot/Foo`) until v3.0 is released, so the change will be invisible to users until then. ([@ydah])
@@ -22,9 +182,9 @@
22
182
  - Add support `be_status` style for `RSpec/Rails/HttpStatus`. ([@ydah])
23
183
  - Add support for shared example groups to `RSpec/EmptyLineAfterExampleGroup`. ([@pirj])
24
184
  - Add support for `RSpec/HaveHttpStatus` when using `response.code`. ([@ydah])
25
- - Fix order of expected and actual in correction for `RSpec/Rails/MinitestAssertions` ([@mvz])
185
+ - Fix order of expected and actual in correction for `RSpec/Rails/MinitestAssertions`. ([@mvz])
26
186
  - Fix a false positive for `RSpec/DescribedClassModuleWrapping` when RSpec.describe numblock is nested within a module. ([@ydah])
27
- - Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` inside `&&`, `||` and `:?` when `omit_parentheses` is on ([@dmitrytsepelev])
187
+ - Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` inside `&&`, `||` and `:?` when `omit_parentheses` is on. ([@dmitrytsepelev])
28
188
  - Fix a false positive for `RSpec/PendingWithoutReason` when pending/skip has a reason inside an example group. ([@ydah])
29
189
  - Fix a false negative for `RSpec/RedundantAround` when redundant numblock `around`. ([@ydah])
30
190
  - Change `RSpec/ContainExactly` to ignore calls with no arguments, and change `RSpec/MatchArray` to ignore calls with an empty array literal argument. ([@ydah], [@bquorning])
@@ -77,7 +237,7 @@
77
237
  - Improved processing speed for `RSpec/Be`, `RSpec/ExpectActual`, `RSpec/ImplicitExpect`, `RSpec/MessageSpies`, `RSpec/PredicateMatcher` and `RSpec/Rails/HaveHttpStatus`. ([@ydah])
78
238
  - Fix wrong autocorrection in `n_times` style on `RSpec/FactoryBot/CreateList`. ([@r7kamura])
79
239
  - Fix a false positive for `RSpec/FactoryBot/ConsistentParenthesesStyle` when using `generate` with multiple arguments. ([@ydah])
80
- - Mark `RSpec/BeEq` as `Safe: false` ([@r7kamura])
240
+ - Mark `RSpec/BeEq` as `Safe: false`. ([@r7kamura])
81
241
  - Add `RSpec/DuplicatedMetadata` cop. ([@r7kamura])
82
242
  - Mark `RSpec/BeEql` as `Safe: false`. ([@r7kamura])
83
243
  - Add `RSpec/PendingWithoutReason` cop. ([@r7kamura])
@@ -110,8 +270,8 @@
110
270
  - Fix a false positive for `RSpec/Capybara/SpecificMatcher` when `have_css("a")` without attribute. ([@ydah])
111
271
  - Update `RSpec/ExampleWording` cop to raise error for insufficient descriptions. ([@akrox58])
112
272
  - Add new `RSpec/Capybara/NegationMatcher` cop. ([@ydah])
113
- - Add `AllowedPatterns` configuration option to `RSpec/NoExpectationExample`. ([@ydah])
114
- - Improve `RSpec/NoExpectationExample` cop to ignore examples skipped or pending via metadata. ([@pirj])
273
+ - Add `AllowedPatterns` configuration option to `RSpec/NoExpectationExample`. ([@ydah])
274
+ - Improve `RSpec/NoExpectationExample` cop to ignore examples skipped or pending via metadata. ([@pirj])
115
275
  - Add `RSpec/FactoryBot/ConsistentParenthesesStyle` cop. ([@Liberatys])
116
276
  - Add `RSpec/Rails/InferredSpecType` cop. ([@r7kamura])
117
277
  - Add new `RSpec/Capybara/SpecificActions` cop. ([@ydah])
@@ -134,7 +294,7 @@
134
294
  ## 2.13.0 (2022-09-12)
135
295
 
136
296
  - Fix `RSpec/FilePath` cop missing mismatched expanded namespace. ([@sl4vr])
137
- - Add new `AllowConsecutiveOneLiners` (default true) option for `Rspec/EmptyLineAfterHook` cop. ([@ngouy])
297
+ - Add new `AllowConsecutiveOneLiners` (default true) option for `RSpec/EmptyLineAfterHook` cop. ([@ngouy])
138
298
  - Add autocorrect support for `RSpec/EmptyExampleGroup`. ([@r7kamura])
139
299
  - Fix `RSpec/ChangeByZero` with compound expressions using `&` or `|` operators. ([@BrianHawley])
140
300
  - Add `RSpec/NoExpectationExample`. ([@r7kamura])
@@ -427,7 +587,7 @@
427
587
  - Add config to `RSpec/VerifiedDoubles` to enforcement of verification on unnamed doubles. ([@BrentWheeldon])
428
588
  - Fix `FactoryBot/AttributeDefinedStatically` not working when there is a non-symbol key. ([@vzvu3k6k])
429
589
  - Fix false positive in `RSpec/ImplicitSubject` when `is_expected` is used inside `its()` block. ([@Darhazer])
430
- - Add `single_statement_only` style to `RSpec/ImplicitSubject` as a more relaxed alternative to `single_line_only`. ([@Darhazer])
590
+ - Add `single_statement_only` style to `RSpec/ImplicitSubject` as a more relaxed alternative to `single_line_only`. ([@Darhazer])
431
591
  - Add `RSpec/UnspecifiedException` as a default cop to encourage more-specific `expect{}.to raise_error(ExceptionType)`, or `raise_exception` style handling of exceptions. ([@daveworth])
432
592
 
433
593
  ## 1.29.1 (2018-09-01)
@@ -462,14 +622,14 @@
462
622
 
463
623
  ## 1.26.0 (2018-06-06)
464
624
 
465
- - Fix false positive in `RSpec/EmptyExampleGroup` cop when methods named like a RSpec method are used. ([@Darhazer])
625
+ - Fix false positive in `RSpec/EmptyExampleGroup` cop when methods named like a RSpec method are used. ([@Darhazer])
466
626
  - Fix `Capybara/FeatureMethods` not working when there is require before the spec. ([@Darhazer])
467
627
  - Fix `RSpec/EmptyLineAfterFinalLet`: allow a comment to be placed after latest let, requiring empty line after the comment. ([@Darhazer])
468
628
  - Add `RSpec/ReceiveCounts` cop to enforce usage of :once and :twice matchers. ([@Darhazer])
469
629
 
470
630
  ## 1.25.1 (2018-04-10)
471
631
 
472
- - Fix false positive in `RSpec/Pending` cop when pending is used as a method name. ([@Darhazer])
632
+ - Fix false positive in `RSpec/Pending` cop when pending is used as a method name. ([@Darhazer])
473
633
  - Fix `FactoryBot/DynamicAttributeDefinedStatically` false positive when using symbol proc argument for a sequence. ([@tdeo])
474
634
 
475
635
  ## 1.25.0 (2018-04-07)
@@ -477,7 +637,7 @@
477
637
  - Add `RSpec/SharedExamples` cop to enforce consistent usage of string to titleize shared examples. ([@anthony-robin])
478
638
  - Add `RSpec/Be` cop to enforce passing argument to the generic `be` matcher. ([@Darhazer])
479
639
  - Fix false positives in `StaticAttributeDefinedDynamically` and `ReturnFromStub` when a const is used in an array or hash. ([@Darhazer])
480
- - Add `RSpec/Pending` cop to enforce no existing pending or skipped examples. This is disabled by default. ([@patrickomatic])
640
+ - Add `RSpec/Pending` cop to enforce no existing pending or skipped examples. This is disabled by default. ([@patrickomatic])
481
641
  - Fix `RSpec/NestedGroups` cop support --auto-gen-config. ([@walf443])
482
642
  - Fix false positives in `Capybara/FeatureMethods` when feature methods are used as property names in a factory. ([@Darhazer])
483
643
  - Allow configuring enabled methods in `Capybara/FeatureMethods`. ([@Darhazer])
@@ -591,7 +751,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
591
751
  ## 1.13.0 (2017-03-07)
592
752
 
593
753
  - Add repeated 'it' detection to `RSpec/ExampleWording` cop. ([@dgollahon])
594
- - Add \[observed_nesting/max_nesting\] info to `RSpec/NestedGroups` messages. ([@dgollahon])
754
+ - Add [observed_nesting/max_nesting] info to `RSpec/NestedGroups` messages. ([@dgollahon])
595
755
  - Add `RSpec/ItBehavesLike` cop. ([@dgollahon])
596
756
  - Add `RSpec/SharedContext` cop. ([@Darhazer])
597
757
  - `RSpec/MultipleExpectations`: Count aggregate_failures block as single expectation. ([@Darhazer])
@@ -762,6 +922,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
762
922
 
763
923
  <!-- Contributors (alphabetically) -->
764
924
 
925
+ [@aarestad]: https://github.com/aarestad
765
926
  [@abrom]: https://github.com/abrom
766
927
  [@ahukkanen]: https://github.com/ahukkanen
767
928
  [@akiomik]: https://github.com/akiomik
@@ -773,23 +934,29 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
773
934
  [@aried3r]: https://github.com/aried3r
774
935
  [@baberthal]: https://github.com/baberthal
775
936
  [@backus]: https://github.com/backus
937
+ [@bcgraham]: https://github.com/bcgraham
776
938
  [@biinari]: https://github.com/biinari
777
939
  [@bmorrall]: https://github.com/bmorrall
778
940
  [@bquorning]: https://github.com/bquorning
779
941
  [@brentwheeldon]: https://github.com/BrentWheeldon
780
942
  [@brianhawley]: https://github.com/BrianHawley
943
+ [@cbliard]: https://github.com/cbliard
781
944
  [@cfabianski]: https://github.com/cfabianski
782
945
  [@clupprich]: https://github.com/clupprich
783
946
  [@composerinteralia]: https://github.com/composerinteralia
947
+ [@corsonknowles]: https://github.com/corsonknowles
948
+ [@corydiamand]: https://github.com/corydiamand
784
949
  [@darhazer]: https://github.com/Darhazer
785
950
  [@daveworth]: https://github.com/daveworth
786
951
  [@dduugg]: https://github.com/dduugg
787
952
  [@deivid-rodriguez]: https://github.com/deivid-rodriguez
788
953
  [@dgollahon]: https://github.com/dgollahon
789
954
  [@dmitrytsepelev]: https://github.com/dmitrytsepelev
955
+ [@drcapulet]: https://github.com/drcapulet
790
956
  [@drowze]: https://github.com/Drowze
791
957
  [@dswij]: https://github.com/dswij
792
958
  [@dvandersluis]: https://github.com/dvandersluis
959
+ [@earlopain]: https://github.com/earlopain
793
960
  [@edgibbs]: https://github.com/edgibbs
794
961
  [@eikes]: https://github.com/eikes
795
962
  [@eitoball]: https://github.com/eitoball
@@ -799,30 +966,39 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
799
966
  [@faucct]: https://github.com/faucct
800
967
  [@foton]: https://github.com/foton
801
968
  [@francois-ferrandis]: https://github.com/francois-ferrandis
969
+ [@franzliedke]: https://github.com/franzliedke
802
970
  [@g-rath]: https://github.com/G-Rath
803
971
  [@geniou]: https://github.com/geniou
804
972
  [@gsamokovarov]: https://github.com/gsamokovarov
805
973
  [@harry-graham]: https://github.com/harry-graham
806
974
  [@harrylewis]: https://github.com/harrylewis
975
+ [@hasghari]: https://github.com/hasghari
807
976
  [@hosamaly]: https://github.com/hosamaly
808
977
  [@ignaciovillaverde]: https://github.com/ignaciovillaverde
809
978
  [@jaredbeck]: https://github.com/jaredbeck
810
979
  [@jaredmoody]: https://github.com/jaredmoody
980
+ [@jdufresne]: https://github.com/jdufresne
811
981
  [@jeffreyc]: https://github.com/jeffreyc
982
+ [@jeppester]: https://github.com/jeppester
983
+ [@jessieay]: https://github.com/jessieay
812
984
  [@jfragoulis]: https://github.com/jfragoulis
813
985
  [@johnny-miyake]: https://github.com/johnny-miyake
814
986
  [@jojos003]: https://github.com/jojos003
815
987
  [@jonatas]: https://github.com/jonatas
816
988
  [@jtannas]: https://github.com/jtannas
989
+ [@k-s-a]: https://github.com/K-S-A
817
990
  [@kellysutton]: https://github.com/kellysutton
818
991
  [@koic]: https://github.com/koic
992
+ [@krororo]: https://github.com/krororo
819
993
  [@kuahyeow]: https://github.com/kuahyeow
820
994
  [@lazycoder9]: https://github.com/lazycoder9
821
995
  [@leoarnold]: https://github.com/leoarnold
822
996
  [@liberatys]: https://github.com/Liberatys
823
997
  [@lokhi]: https://github.com/lokhi
998
+ [@lovro-bikic]: https://github.com/lovro-bikic
824
999
  [@luke-hill]: https://github.com/luke-hill
825
1000
  [@m-yamashita01]: https://github.com/M-Yamashita01
1001
+ [@marocchino]: https://github.com/marocchino
826
1002
  [@miguelfteixeira]: https://github.com/miguelfteixeira
827
1003
  [@mkenyon]: https://github.com/mkenyon
828
1004
  [@mkrawc]: https://github.com/mkrawc
@@ -830,6 +1006,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
830
1006
  [@mockdeep]: https://github.com/mockdeep
831
1007
  [@mothonmars]: https://github.com/MothOnMars
832
1008
  [@mvz]: https://github.com/mvz
1009
+ [@naveg]: https://github.com/naveg
833
1010
  [@nc-holodakg]: https://github.com/nc-holodakg
834
1011
  [@nevir]: https://github.com/nevir
835
1012
  [@ngouy]: https://github.com/ngouy
@@ -849,6 +1026,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
849
1026
  [@rafix02]: https://github.com/Rafix02
850
1027
  [@redross]: https://github.com/redross
851
1028
  [@renanborgescampos]: https://github.com/renanborgescampos
1029
+ [@robinaugh]: https://github.com/robinaugh
852
1030
  [@robotdana]: https://github.com/robotdana
853
1031
  [@rolfschmidt]: https://github.com/rolfschmidt
854
1032
  [@rrosenblum]: https://github.com/rrosenblum
@@ -859,17 +1037,21 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
859
1037
  [@seanpdoyle]: https://github.com/seanpdoyle
860
1038
  [@sl4vr]: https://github.com/sl4vr
861
1039
  [@smcgivern]: https://github.com/smcgivern
1040
+ [@splattael]: https://github.com/splattael
862
1041
  [@stephannv]: https://github.com/stephannv
1042
+ [@swelther]: https://github.com/swelther
863
1043
  [@t3h2mas]: https://github.com/t3h2mas
864
1044
  [@tdeo]: https://github.com/tdeo
865
1045
  [@tejasbubane]: https://github.com/tejasbubane
866
1046
  [@telmofcosta]: https://github.com/telmofcosta
867
1047
  [@tietew]: https://github.com/Tietew
868
1048
  [@timrogers]: https://github.com/timrogers
1049
+ [@tmaier]: https://github.com/tmaier
869
1050
  [@topalovic]: https://github.com/topalovic
870
1051
  [@twalpole]: https://github.com/twalpole
871
1052
  [@vzvu3k6k]: https://github.com/vzvu3k6k
872
1053
  [@walf443]: https://github.com/walf443
1054
+ [@yasu551]: https://github.com/yasu551
873
1055
  [@ybiquitous]: https://github.com/ybiquitous
874
1056
  [@ydah]: https://github.com/ydah
875
1057
  [@yevhene]: https://github.com/yevhene
data/README.md CHANGED
@@ -7,6 +7,15 @@
7
7
  [RSpec](https://rspec.info/)-specific analysis for your projects, as an extension to
8
8
  [RuboCop](https://github.com/rubocop/rubocop).
9
9
 
10
+ - [Installation](#installation)
11
+ - [Upgrading to RuboCop RSpec v3.x](#upgrading-to-rubocop-rspec-v3x)
12
+ - [Upgrading to RuboCop RSpec v2.x](#upgrading-to-rubocop-rspec-v2x)
13
+ - [Usage](#usage)
14
+ - [Documentation](#documentation)
15
+ - [The Cops](#the-cops)
16
+ - [Contributing](#contributing)
17
+ - [License](#license)
18
+
10
19
  ## Installation
11
20
 
12
21
  Just install the `rubocop-rspec` gem
@@ -17,10 +26,14 @@ gem install rubocop-rspec
17
26
 
18
27
  or if you use bundler put this in your `Gemfile`
19
28
 
20
- ```
29
+ ```ruby
21
30
  gem 'rubocop-rspec', require: false
22
31
  ```
23
32
 
33
+ ### Upgrading to RuboCop RSpec v3.x
34
+
35
+ Read all the details in our [Upgrade to Version 3.x](https://docs.rubocop.org/rubocop-rspec/3.0/upgrade_to_version_3.html) document.
36
+
24
37
  ### Upgrading to RuboCop RSpec v2.x
25
38
 
26
39
  Read all the details in our [Upgrade to Version 2.x](https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html) document.
@@ -81,7 +94,7 @@ In your `.rubocop.yml`, you may treat the RSpec cops just like any other
81
94
  cop. For example:
82
95
 
83
96
  ```yaml
84
- RSpec/FilePath:
97
+ RSpec/SpecFilePathFormat:
85
98
  Exclude:
86
99
  - spec/my_poorly_named_spec_file.rb
87
100
  ```