rubocop-rspec 1.7.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +955 -79
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/MIT-LICENSE.md +1 -2
  5. data/README.md +35 -35
  6. data/config/default.yml +940 -52
  7. data/config/obsoletion.yml +30 -0
  8. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +49 -0
  9. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +49 -0
  10. data/lib/rubocop/cop/rspec/any_instance.rb +10 -13
  11. data/lib/rubocop/cop/rspec/around_block.rb +97 -0
  12. data/lib/rubocop/cop/rspec/base.rb +26 -0
  13. data/lib/rubocop/cop/rspec/be.rb +39 -0
  14. data/lib/rubocop/cop/rspec/be_empty.rb +45 -0
  15. data/lib/rubocop/cop/rspec/be_eq.rb +47 -0
  16. data/lib/rubocop/cop/rspec/be_eql.rb +18 -15
  17. data/lib/rubocop/cop/rspec/be_nil.rb +74 -0
  18. data/lib/rubocop/cop/rspec/before_after_all.rb +45 -0
  19. data/lib/rubocop/cop/rspec/change_by_zero.rb +184 -0
  20. data/lib/rubocop/cop/rspec/class_check.rb +101 -0
  21. data/lib/rubocop/cop/rspec/contain_exactly.rb +56 -0
  22. data/lib/rubocop/cop/rspec/context_method.rb +57 -0
  23. data/lib/rubocop/cop/rspec/context_wording.rb +117 -0
  24. data/lib/rubocop/cop/rspec/describe_class.rb +52 -21
  25. data/lib/rubocop/cop/rspec/describe_method.rb +26 -11
  26. data/lib/rubocop/cop/rspec/describe_symbol.rb +37 -0
  27. data/lib/rubocop/cop/rspec/described_class.rb +181 -34
  28. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +38 -0
  29. data/lib/rubocop/cop/rspec/dialect.rb +84 -0
  30. data/lib/rubocop/cop/rspec/duplicated_metadata.rb +58 -0
  31. data/lib/rubocop/cop/rspec/empty_example_group.rb +134 -47
  32. data/lib/rubocop/cop/rspec/empty_hook.rb +49 -0
  33. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +82 -0
  34. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +42 -0
  35. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +40 -0
  36. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +82 -0
  37. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +36 -0
  38. data/lib/rubocop/cop/rspec/empty_metadata.rb +46 -0
  39. data/lib/rubocop/cop/rspec/empty_output.rb +47 -0
  40. data/lib/rubocop/cop/rspec/eq.rb +47 -0
  41. data/lib/rubocop/cop/rspec/example_length.rb +38 -20
  42. data/lib/rubocop/cop/rspec/example_without_description.rb +98 -0
  43. data/lib/rubocop/cop/rspec/example_wording.rb +117 -27
  44. data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +110 -0
  45. data/lib/rubocop/cop/rspec/expect_actual.rb +46 -20
  46. data/lib/rubocop/cop/rspec/expect_change.rb +86 -0
  47. data/lib/rubocop/cop/rspec/expect_in_hook.rb +50 -0
  48. data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
  49. data/lib/rubocop/cop/rspec/expect_output.rb +50 -0
  50. data/lib/rubocop/cop/rspec/focus.rb +79 -25
  51. data/lib/rubocop/cop/rspec/hook_argument.rb +48 -36
  52. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +81 -0
  53. data/lib/rubocop/cop/rspec/identical_equality_assertion.rb +37 -0
  54. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +68 -0
  55. data/lib/rubocop/cop/rspec/implicit_expect.rb +100 -0
  56. data/lib/rubocop/cop/rspec/implicit_subject.rb +167 -0
  57. data/lib/rubocop/cop/rspec/indexed_let.rb +112 -0
  58. data/lib/rubocop/cop/rspec/instance_spy.rb +74 -0
  59. data/lib/rubocop/cop/rspec/instance_variable.rb +28 -14
  60. data/lib/rubocop/cop/rspec/is_expected_specify.rb +45 -0
  61. data/lib/rubocop/cop/rspec/it_behaves_like.rb +49 -0
  62. data/lib/rubocop/cop/rspec/iterated_expectation.rb +74 -0
  63. data/lib/rubocop/cop/rspec/leading_subject.rb +57 -29
  64. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +127 -0
  65. data/lib/rubocop/cop/rspec/let_before_examples.rb +101 -0
  66. data/lib/rubocop/cop/rspec/let_setup.rb +32 -16
  67. data/lib/rubocop/cop/rspec/match_array.rb +59 -0
  68. data/lib/rubocop/cop/rspec/message_chain.rb +10 -15
  69. data/lib/rubocop/cop/rspec/message_expectation.rb +12 -9
  70. data/lib/rubocop/cop/rspec/message_spies.rb +88 -0
  71. data/lib/rubocop/cop/rspec/metadata_style.rb +202 -0
  72. data/lib/rubocop/cop/rspec/missing_example_group_argument.rb +35 -0
  73. data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
  74. data/lib/rubocop/cop/rspec/mixin/comments_help.rb +38 -0
  75. data/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb +59 -0
  76. data/lib/rubocop/cop/rspec/mixin/file_help.rb +14 -0
  77. data/lib/rubocop/cop/rspec/mixin/final_end_location.rb +19 -0
  78. data/lib/rubocop/cop/rspec/mixin/inside_example_group.rb +29 -0
  79. data/lib/rubocop/cop/rspec/mixin/location_help.rb +37 -0
  80. data/lib/rubocop/cop/rspec/mixin/metadata.rb +63 -0
  81. data/lib/rubocop/cop/rspec/mixin/namespace.rb +23 -0
  82. data/lib/rubocop/cop/rspec/mixin/skip_or_pending.rb +39 -0
  83. data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +54 -0
  84. data/lib/rubocop/cop/rspec/mixin/variable.rb +21 -0
  85. data/lib/rubocop/cop/rspec/multiple_describes.rb +14 -12
  86. data/lib/rubocop/cop/rspec/multiple_expectations.rb +86 -26
  87. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +146 -0
  88. data/lib/rubocop/cop/rspec/multiple_subjects.rb +97 -0
  89. data/lib/rubocop/cop/rspec/named_subject.rb +107 -27
  90. data/lib/rubocop/cop/rspec/nested_groups.rb +84 -47
  91. data/lib/rubocop/cop/rspec/no_expectation_example.rb +102 -0
  92. data/lib/rubocop/cop/rspec/not_to_not.rb +30 -27
  93. data/lib/rubocop/cop/rspec/overwriting_setup.rb +74 -0
  94. data/lib/rubocop/cop/rspec/pending.rb +80 -0
  95. data/lib/rubocop/cop/rspec/pending_without_reason.rb +159 -0
  96. data/lib/rubocop/cop/rspec/predicate_matcher.rb +341 -0
  97. data/lib/rubocop/cop/rspec/receive_counts.rb +89 -0
  98. data/lib/rubocop/cop/rspec/receive_messages.rb +161 -0
  99. data/lib/rubocop/cop/rspec/receive_never.rb +41 -0
  100. data/lib/rubocop/cop/rspec/redundant_around.rb +65 -0
  101. data/lib/rubocop/cop/rspec/redundant_predicate_matcher.rb +67 -0
  102. data/lib/rubocop/cop/rspec/remove_const.rb +39 -0
  103. data/lib/rubocop/cop/rspec/repeated_description.rb +98 -0
  104. data/lib/rubocop/cop/rspec/repeated_example.rb +53 -0
  105. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +100 -0
  106. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +96 -0
  107. data/lib/rubocop/cop/rspec/repeated_include_example.rb +105 -0
  108. data/lib/rubocop/cop/rspec/repeated_subject_call.rb +125 -0
  109. data/lib/rubocop/cop/rspec/return_from_stub.rb +169 -0
  110. data/lib/rubocop/cop/rspec/scattered_let.rb +59 -0
  111. data/lib/rubocop/cop/rspec/scattered_setup.rb +92 -0
  112. data/lib/rubocop/cop/rspec/shared_context.rb +107 -0
  113. data/lib/rubocop/cop/rspec/shared_examples.rb +125 -0
  114. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +93 -0
  115. data/lib/rubocop/cop/rspec/skip_block_inside_example.rb +46 -0
  116. data/lib/rubocop/cop/rspec/sort_metadata.rb +71 -0
  117. data/lib/rubocop/cop/rspec/spec_file_path_format.rb +133 -0
  118. data/lib/rubocop/cop/rspec/spec_file_path_suffix.rb +40 -0
  119. data/lib/rubocop/cop/rspec/stubbed_mock.rb +176 -0
  120. data/lib/rubocop/cop/rspec/subject_declaration.rb +46 -0
  121. data/lib/rubocop/cop/rspec/subject_stub.rb +93 -74
  122. data/lib/rubocop/cop/rspec/undescriptive_literals_description.rb +69 -0
  123. data/lib/rubocop/cop/rspec/unspecified_exception.rb +67 -0
  124. data/lib/rubocop/cop/rspec/variable_definition.rb +77 -0
  125. data/lib/rubocop/cop/rspec/variable_name.rb +68 -0
  126. data/lib/rubocop/cop/rspec/verified_double_reference.rb +111 -0
  127. data/lib/rubocop/cop/rspec/verified_doubles.rb +28 -14
  128. data/lib/rubocop/cop/rspec/void_expect.rb +60 -0
  129. data/lib/rubocop/cop/rspec/yield.rb +82 -0
  130. data/lib/rubocop/cop/rspec_cops.rb +112 -0
  131. data/lib/rubocop/rspec/align_let_brace.rb +63 -0
  132. data/lib/rubocop/rspec/concept.rb +33 -0
  133. data/lib/rubocop/rspec/config_formatter.rb +27 -4
  134. data/lib/rubocop/rspec/cop/generator.rb +25 -0
  135. data/lib/rubocop/rspec/corrector/move_node.rb +51 -0
  136. data/lib/rubocop/rspec/description_extractor.rb +60 -18
  137. data/lib/rubocop/rspec/example.rb +37 -0
  138. data/lib/rubocop/rspec/example_group.rb +67 -0
  139. data/lib/rubocop/rspec/hook.rb +79 -0
  140. data/lib/rubocop/rspec/inject.rb +3 -1
  141. data/lib/rubocop/rspec/language.rb +184 -41
  142. data/lib/rubocop/rspec/node.rb +19 -0
  143. data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +29 -0
  144. data/lib/rubocop/rspec/version.rb +1 -1
  145. data/lib/rubocop/rspec/wording.rb +61 -19
  146. data/lib/rubocop/rspec.rb +6 -2
  147. data/lib/rubocop-rspec.rb +45 -34
  148. metadata +130 -195
  149. data/Gemfile +0 -13
  150. data/Rakefile +0 -48
  151. data/lib/rubocop/cop/rspec/file_path.rb +0 -83
  152. data/lib/rubocop/rspec/language/node_pattern.rb +0 -16
  153. data/lib/rubocop/rspec/spec_only.rb +0 -61
  154. data/lib/rubocop/rspec/top_level_describe.rb +0 -61
  155. data/lib/rubocop/rspec/util.rb +0 -19
  156. data/rubocop-rspec.gemspec +0 -42
  157. data/spec/expect_violation/expectation_spec.rb +0 -85
  158. data/spec/project/changelog_spec.rb +0 -81
  159. data/spec/project/default_config_spec.rb +0 -52
  160. data/spec/project/project_requires_spec.rb +0 -8
  161. data/spec/rubocop/cop/rspec/any_instance_spec.rb +0 -30
  162. data/spec/rubocop/cop/rspec/be_eql_spec.rb +0 -59
  163. data/spec/rubocop/cop/rspec/describe_class_spec.rb +0 -113
  164. data/spec/rubocop/cop/rspec/describe_method_spec.rb +0 -32
  165. data/spec/rubocop/cop/rspec/described_class_spec.rb +0 -219
  166. data/spec/rubocop/cop/rspec/empty_example_group_spec.rb +0 -79
  167. data/spec/rubocop/cop/rspec/example_length_spec.rb +0 -117
  168. data/spec/rubocop/cop/rspec/example_wording_spec.rb +0 -82
  169. data/spec/rubocop/cop/rspec/expect_actual_spec.rb +0 -136
  170. data/spec/rubocop/cop/rspec/file_path_spec.rb +0 -236
  171. data/spec/rubocop/cop/rspec/focus_spec.rb +0 -130
  172. data/spec/rubocop/cop/rspec/hook_argument_spec.rb +0 -189
  173. data/spec/rubocop/cop/rspec/instance_variable_spec.rb +0 -75
  174. data/spec/rubocop/cop/rspec/leading_subject_spec.rb +0 -54
  175. data/spec/rubocop/cop/rspec/let_setup_spec.rb +0 -66
  176. data/spec/rubocop/cop/rspec/message_chain_spec.rb +0 -21
  177. data/spec/rubocop/cop/rspec/message_expectation_spec.rb +0 -63
  178. data/spec/rubocop/cop/rspec/multiple_describes_spec.rb +0 -28
  179. data/spec/rubocop/cop/rspec/multiple_expectations_spec.rb +0 -84
  180. data/spec/rubocop/cop/rspec/named_subject_spec.rb +0 -62
  181. data/spec/rubocop/cop/rspec/nested_groups_spec.rb +0 -55
  182. data/spec/rubocop/cop/rspec/not_to_not_spec.rb +0 -57
  183. data/spec/rubocop/cop/rspec/subject_stub_spec.rb +0 -183
  184. data/spec/rubocop/cop/rspec/verified_doubles_spec.rb +0 -71
  185. data/spec/rubocop/rspec/config_formatter_spec.rb +0 -48
  186. data/spec/rubocop/rspec/description_extractor_spec.rb +0 -35
  187. data/spec/rubocop/rspec/language/selector_set_spec.rb +0 -29
  188. data/spec/rubocop/rspec/spec_only_spec.rb +0 -97
  189. data/spec/rubocop/rspec/util/one_spec.rb +0 -21
  190. data/spec/rubocop/rspec/wording_spec.rb +0 -44
  191. data/spec/shared/rspec_only_cop_behavior.rb +0 -68
  192. data/spec/spec_helper.rb +0 -41
  193. data/spec/support/expect_violation.rb +0 -166
data/config/default.yml CHANGED
@@ -1,130 +1,1018 @@
1
1
  ---
2
- AllCops:
3
- RSpec:
4
- Patterns:
5
- - _spec.rb
6
- - "(?:^|/)spec/"
2
+ RSpec:
3
+ Enabled: true
4
+ StyleGuideBaseURL: https://rspec.rubystyle.guide
5
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec
6
+ Include:
7
+ - "**/*_spec.rb"
8
+ - "**/spec/**/*"
9
+ Language:
10
+ inherit_mode:
11
+ merge:
12
+ - Expectations
13
+ - Helpers
14
+ - Hooks
15
+ - Subjects
16
+ ExampleGroups:
17
+ inherit_mode:
18
+ merge:
19
+ - Regular
20
+ - Skipped
21
+ - Focused
22
+ Regular:
23
+ - describe
24
+ - context
25
+ - feature
26
+ - example_group
27
+ Skipped:
28
+ - xdescribe
29
+ - xcontext
30
+ - xfeature
31
+ Focused:
32
+ - fdescribe
33
+ - fcontext
34
+ - ffeature
35
+ Examples:
36
+ inherit_mode:
37
+ merge:
38
+ - Regular
39
+ - Skipped
40
+ - Focused
41
+ - Pending
42
+ Regular:
43
+ - it
44
+ - specify
45
+ - example
46
+ - scenario
47
+ - its
48
+ Focused:
49
+ - fit
50
+ - fspecify
51
+ - fexample
52
+ - fscenario
53
+ - focus
54
+ Skipped:
55
+ - xit
56
+ - xspecify
57
+ - xexample
58
+ - xscenario
59
+ - skip
60
+ Pending:
61
+ - pending
62
+ Expectations:
63
+ - are_expected
64
+ - expect
65
+ - expect_any_instance_of
66
+ - is_expected
67
+ - should
68
+ - should_not
69
+ - should_not_receive
70
+ - should_receive
71
+ Helpers:
72
+ - let
73
+ - let!
74
+ Hooks:
75
+ - prepend_before
76
+ - before
77
+ - append_before
78
+ - around
79
+ - prepend_after
80
+ - after
81
+ - append_after
82
+ Includes:
83
+ inherit_mode:
84
+ merge:
85
+ - Examples
86
+ - Context
87
+ Examples:
88
+ - it_behaves_like
89
+ - it_should_behave_like
90
+ - include_examples
91
+ Context:
92
+ - include_context
93
+ SharedGroups:
94
+ inherit_mode:
95
+ merge:
96
+ - Examples
97
+ - Context
98
+ Examples:
99
+ - shared_examples
100
+ - shared_examples_for
101
+ Context:
102
+ - shared_context
103
+ Subjects:
104
+ - subject
105
+ - subject!
106
+
107
+ Metrics/BlockLength:
108
+ inherit_mode:
109
+ merge:
110
+ - Exclude
111
+ Exclude:
112
+ - "**/*_spec.rb"
113
+ - "**/spec/**/*"
114
+
115
+ RSpec/AlignLeftLetBrace:
116
+ Description: Checks that left braces for adjacent single line lets are aligned.
117
+ Enabled: false
118
+ VersionAdded: '1.16'
119
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
120
+
121
+ RSpec/AlignRightLetBrace:
122
+ Description: Checks that right braces for adjacent single line lets are aligned.
123
+ Enabled: false
124
+ VersionAdded: '1.16'
125
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
7
126
 
8
127
  RSpec/AnyInstance:
9
128
  Description: Check that instances are not being stubbed globally.
10
129
  Enabled: true
130
+ VersionAdded: '1.4'
131
+ StyleGuide: https://rspec.rubystyle.guide/#any_instance_of
132
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
133
+
134
+ RSpec/AroundBlock:
135
+ Description: Checks that around blocks actually run the test.
136
+ Enabled: true
137
+ VersionAdded: '1.11'
138
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
139
+
140
+ RSpec/Be:
141
+ Description: Check for expectations where `be` is used without argument.
142
+ Enabled: true
143
+ VersionAdded: '1.25'
144
+ StyleGuide: https://rspec.rubystyle.guide/#be-matcher
145
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
146
+
147
+ RSpec/BeEmpty:
148
+ Description: Prefer using `be_empty` when checking for an empty array.
149
+ Enabled: true
150
+ AutoCorrect: contextual
151
+ VersionAdded: '2.20'
152
+ VersionChanged: '2.31'
153
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEmpty
154
+
155
+ RSpec/BeEq:
156
+ Description: Check for expectations where `be(...)` can replace `eq(...)`.
157
+ Enabled: true
158
+ Safe: false
159
+ VersionAdded: 2.9.0
160
+ VersionChanged: '2.16'
161
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
11
162
 
12
163
  RSpec/BeEql:
13
164
  Description: Check for expectations where `be(...)` can replace `eql(...)`.
14
165
  Enabled: true
166
+ Safe: false
167
+ VersionAdded: '1.7'
168
+ VersionChanged: '2.16'
169
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
15
170
 
16
- RSpec/HookArgument:
17
- Description: Checks the arguments passed to `before`, `around`, and `after`.
171
+ RSpec/BeNil:
172
+ Description: Ensures a consistent style is used when matching `nil`.
18
173
  Enabled: true
19
- EnforcedStyle: implicit
174
+ EnforcedStyle: be_nil
175
+ SupportedStyles:
176
+ - be
177
+ - be_nil
178
+ VersionAdded: 2.9.0
179
+ VersionChanged: 2.10.0
180
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
181
+
182
+ RSpec/BeforeAfterAll:
183
+ Description: Check that before/after(:all/:context) isn't being used.
184
+ Enabled: true
185
+ Exclude:
186
+ - "**/spec/spec_helper.rb"
187
+ - "**/spec/rails_helper.rb"
188
+ - "**/spec/support/**/*.rb"
189
+ VersionAdded: '1.12'
190
+ VersionChanged: '2.23'
191
+ StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
192
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
193
+
194
+ RSpec/ChangeByZero:
195
+ Description: Prefer negated matchers over `to change.by(0)`.
196
+ Enabled: true
197
+ VersionAdded: '2.11'
198
+ VersionChanged: '2.14'
199
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero
200
+ NegatedMatcher: ~
201
+
202
+ RSpec/ClassCheck:
203
+ Description: Enforces consistent use of `be_a` or `be_kind_of`.
204
+ StyleGuide: "#is-a-vs-kind-of"
205
+ Enabled: true
206
+ VersionAdded: '2.13'
207
+ EnforcedStyle: be_a
20
208
  SupportedStyles:
21
- - implicit
22
- - each
23
- - example
209
+ - be_a
210
+ - be_kind_of
211
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck
212
+
213
+ RSpec/ContainExactly:
214
+ Description: Checks where `contain_exactly` is used.
215
+ Enabled: true
216
+ VersionAdded: '2.19'
217
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContainExactly
218
+
219
+ RSpec/ContextMethod:
220
+ Description: "`context` should not be used for specifying methods."
221
+ Enabled: true
222
+ VersionAdded: '1.36'
223
+ StyleGuide: https://rspec.rubystyle.guide/#example-group-naming
224
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
225
+
226
+ RSpec/ContextWording:
227
+ Description: Checks that `context` docstring starts with an allowed prefix.
228
+ Enabled: true
229
+ Prefixes:
230
+ - when
231
+ - with
232
+ - without
233
+ AllowedPatterns: []
234
+ VersionAdded: '1.20'
235
+ VersionChanged: '2.13'
236
+ StyleGuide: https://rspec.rubystyle.guide/#context-descriptions
237
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
24
238
 
25
239
  RSpec/DescribeClass:
26
- Description: Check that the first argument to the top level describe is a constant.
240
+ Description: Check that the first argument to the top-level describe is a constant.
241
+ Enabled: true
242
+ Exclude:
243
+ - "**/spec/features/**/*"
244
+ - "**/spec/requests/**/*"
245
+ - "**/spec/routing/**/*"
246
+ - "**/spec/system/**/*"
247
+ - "**/spec/views/**/*"
248
+ IgnoredMetadata:
249
+ type:
250
+ - channel
251
+ - controller
252
+ - helper
253
+ - job
254
+ - mailer
255
+ - model
256
+ - request
257
+ - routing
258
+ - view
259
+ - feature
260
+ - system
261
+ - mailbox
262
+ - aruba
263
+ - task
264
+ VersionAdded: '1.0'
265
+ VersionChanged: '2.7'
266
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
267
+
268
+ RSpec/DescribeMethod:
269
+ Description: Checks that the second argument to `describe` specifies a method.
27
270
  Enabled: true
271
+ VersionAdded: '1.0'
272
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
273
+
274
+ RSpec/DescribeSymbol:
275
+ Description: Avoid describing symbols.
276
+ Enabled: true
277
+ VersionAdded: '1.15'
278
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
28
279
 
29
280
  RSpec/DescribedClass:
30
281
  Description: Checks that tests use `described_class`.
282
+ Enabled: true
31
283
  SkipBlocks: false
284
+ EnforcedStyle: described_class
285
+ SupportedStyles:
286
+ - described_class
287
+ - explicit
288
+ OnlyStaticConstants: true
289
+ SafeAutoCorrect: false
290
+ VersionAdded: '1.0'
291
+ VersionChanged: '2.27'
292
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
293
+
294
+ RSpec/DescribedClassModuleWrapping:
295
+ Description: Avoid opening modules and defining specs within them.
296
+ Enabled: false
297
+ VersionAdded: '1.37'
298
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
299
+
300
+ RSpec/Dialect:
301
+ Description: Enforces custom RSpec dialects.
302
+ Enabled: false
303
+ PreferredMethods: {}
304
+ VersionAdded: '1.33'
305
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
306
+
307
+ RSpec/DuplicatedMetadata:
308
+ Description: Avoid duplicated metadata.
32
309
  Enabled: true
310
+ VersionAdded: '2.16'
311
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
33
312
 
34
- RSpec/DescribeMethod:
35
- Description: Checks that the second argument to `describe` specifies a method.
313
+ RSpec/EmptyExampleGroup:
314
+ Description: Checks if an example group does not include any tests.
315
+ Enabled: true
316
+ AutoCorrect: contextual
317
+ SafeAutoCorrect: false
318
+ VersionAdded: '1.7'
319
+ VersionChanged: '2.31'
320
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
321
+
322
+ RSpec/EmptyHook:
323
+ Description: Checks for empty before and after hooks.
324
+ Enabled: true
325
+ AutoCorrect: contextual
326
+ VersionAdded: '1.39'
327
+ VersionChanged: '2.31'
328
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
329
+
330
+ RSpec/EmptyLineAfterExample:
331
+ Description: Checks if there is an empty line after example blocks.
36
332
  Enabled: true
333
+ AllowConsecutiveOneLiners: true
334
+ VersionAdded: '1.36'
335
+ StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples
336
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
337
+
338
+ RSpec/EmptyLineAfterExampleGroup:
339
+ Description: Checks if there is an empty line after example group blocks.
340
+ Enabled: true
341
+ VersionAdded: '1.27'
342
+ StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes
343
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
344
+
345
+ RSpec/EmptyLineAfterFinalLet:
346
+ Description: Checks if there is an empty line after the last let block.
347
+ Enabled: true
348
+ VersionAdded: '1.14'
349
+ StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
350
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
351
+
352
+ RSpec/EmptyLineAfterHook:
353
+ Description: Checks if there is an empty line after hook blocks.
354
+ Enabled: true
355
+ VersionAdded: '1.27'
356
+ VersionChanged: '2.13'
357
+ StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
358
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
359
+ AllowConsecutiveOneLiners: true
360
+
361
+ RSpec/EmptyLineAfterSubject:
362
+ Description: Checks if there is an empty line after subject block.
363
+ Enabled: true
364
+ VersionAdded: '1.14'
365
+ StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
366
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
367
+
368
+ RSpec/EmptyMetadata:
369
+ Description: Avoid empty metadata hash.
370
+ Enabled: true
371
+ AutoCorrect: contextual
372
+ VersionAdded: '2.24'
373
+ VersionChanged: '2.31'
374
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyMetadata
375
+
376
+ RSpec/EmptyOutput:
377
+ Description: Check that the `output` matcher is not called with an empty string.
378
+ Enabled: true
379
+ VersionAdded: '2.29'
380
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyOutput
381
+
382
+ RSpec/Eq:
383
+ Description: Use `eq` instead of `be ==` to compare objects.
384
+ Enabled: true
385
+ VersionAdded: '2.24'
386
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Eq
387
+
388
+ RSpec/ExampleLength:
389
+ Description: Checks for long examples.
390
+ Enabled: true
391
+ Max: 5
392
+ CountAsOne: []
393
+ VersionAdded: '1.5'
394
+ VersionChanged: '2.3'
395
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
396
+
397
+ RSpec/ExampleWithoutDescription:
398
+ Description: Checks for examples without a description.
399
+ Enabled: true
400
+ EnforcedStyle: always_allow
401
+ SupportedStyles:
402
+ - always_allow
403
+ - single_line_only
404
+ - disallow
405
+ VersionAdded: '1.22'
406
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
37
407
 
38
408
  RSpec/ExampleWording:
39
- Description: Checks that example descriptions do not start with "should".
409
+ Description: Checks for common mistakes in example descriptions.
40
410
  Enabled: true
41
411
  CustomTransform:
42
412
  be: is
413
+ BE: IS
43
414
  have: has
44
- not: does not
415
+ HAVE: HAS
45
416
  IgnoredWords: []
417
+ DisallowedExamples:
418
+ - works
419
+ VersionAdded: '1.0'
420
+ VersionChanged: '2.13'
421
+ StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
422
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
46
423
 
47
- RSpec/EmptyExampleGroup:
48
- Description: Checks if an example group does not include any tests.
424
+ RSpec/ExcessiveDocstringSpacing:
425
+ Description: Checks for excessive whitespace in example descriptions.
49
426
  Enabled: true
50
- CustomIncludeMethods: []
427
+ VersionAdded: '2.5'
428
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
51
429
 
52
430
  RSpec/ExpectActual:
53
431
  Description: Checks for `expect(...)` calls containing literal values.
54
432
  Enabled: true
433
+ Exclude:
434
+ - "**/spec/routing/**/*"
435
+ VersionAdded: '1.7'
436
+ VersionChanged: '2.23'
437
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
55
438
 
56
- RSpec/MessageChain:
57
- Description: Check that chains of messages are not being stubbed.
439
+ RSpec/ExpectChange:
440
+ Description: Checks for consistent style of change matcher.
58
441
  Enabled: true
442
+ EnforcedStyle: method_call
443
+ SupportedStyles:
444
+ - method_call
445
+ - block
446
+ SafeAutoCorrect: false
447
+ VersionAdded: '1.22'
448
+ VersionChanged: '2.5'
449
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
59
450
 
60
- RSpec/MultipleDescribes:
61
- Description: Checks for multiple top level describes.
451
+ RSpec/ExpectInHook:
452
+ Description: Do not use `expect` in hooks such as `before`.
62
453
  Enabled: true
454
+ VersionAdded: '1.16'
455
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
63
456
 
64
- RSpec/MultipleExpectations:
65
- Description: Checks if examples contain too many `expect` calls.
457
+ RSpec/ExpectInLet:
458
+ Description: Do not use `expect` in let.
459
+ Enabled: true
460
+ VersionAdded: '2.30'
461
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInLet
462
+
463
+ RSpec/ExpectOutput:
464
+ Description: Checks for opportunities to use `expect { ... }.to output`.
465
+ Enabled: true
466
+ VersionAdded: '1.10'
467
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
468
+
469
+ RSpec/Focus:
470
+ Description: Checks if examples are focused.
471
+ Enabled: true
472
+ AutoCorrect: contextual
473
+ VersionAdded: '1.5'
474
+ VersionChanged: '2.31'
475
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
476
+
477
+ RSpec/HookArgument:
478
+ Description: Checks the arguments passed to `before`, `around`, and `after`.
479
+ Enabled: true
480
+ EnforcedStyle: implicit
481
+ SupportedStyles:
482
+ - implicit
483
+ - each
484
+ - example
485
+ VersionAdded: '1.7'
486
+ StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach
487
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
488
+
489
+ RSpec/HooksBeforeExamples:
490
+ Description: Checks for before/around/after hooks that come after an example.
491
+ Enabled: true
492
+ AutoCorrect: contextual
493
+ VersionAdded: '1.29'
494
+ VersionChanged: '2.31'
495
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
496
+
497
+ RSpec/IdenticalEqualityAssertion:
498
+ Description: Checks for equality assertions with identical expressions on both sides.
499
+ Enabled: true
500
+ VersionAdded: '2.4'
501
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
502
+
503
+ RSpec/ImplicitBlockExpectation:
504
+ Description: Check that implicit block expectation syntax is not used.
505
+ Enabled: true
506
+ VersionAdded: '1.35'
507
+ StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations
508
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
509
+
510
+ RSpec/ImplicitExpect:
511
+ Description: Check that a consistent implicit expectation style is used.
512
+ Enabled: true
513
+ EnforcedStyle: is_expected
514
+ SupportedStyles:
515
+ - is_expected
516
+ - should
517
+ VersionAdded: '1.8'
518
+ StyleGuide: https://rspec.rubystyle.guide/#use-expect
519
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
520
+
521
+ RSpec/ImplicitSubject:
522
+ Description: Checks for usage of implicit subject (`is_expected` / `should`).
523
+ Enabled: true
524
+ EnforcedStyle: single_line_only
525
+ SupportedStyles:
526
+ - single_line_only
527
+ - single_statement_only
528
+ - disallow
529
+ - require_implicit
530
+ VersionAdded: '1.29'
531
+ VersionChanged: '2.13'
532
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
533
+
534
+ RSpec/IndexedLet:
535
+ Description: Do not set up test data using indexes (e.g., `item_1`, `item_2`).
66
536
  Enabled: true
537
+ VersionAdded: '2.20'
538
+ VersionChanged: '2.23'
539
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IndexedLet
67
540
  Max: 1
541
+ AllowedIdentifiers: []
542
+ AllowedPatterns: []
68
543
 
69
- RSpec/NestedGroups:
70
- Description: Checks for nested example groups.
544
+ RSpec/InstanceSpy:
545
+ Description: Checks for `instance_double` used with `have_received`.
71
546
  Enabled: true
72
- MaxNesting: 2
547
+ VersionAdded: '1.12'
548
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
73
549
 
74
550
  RSpec/InstanceVariable:
75
551
  Description: Checks for instance variable usage in specs.
552
+ Enabled: true
76
553
  AssignmentOnly: false
554
+ VersionAdded: '1.0'
555
+ VersionChanged: '1.7'
556
+ StyleGuide: https://rspec.rubystyle.guide/#instance-variables
557
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
558
+
559
+ RSpec/IsExpectedSpecify:
560
+ Description: Check for `specify` with `is_expected` and one-liner expectations.
561
+ Enabled: true
562
+ VersionAdded: '2.27'
563
+ StyleGuide: https://rspec.rubystyle.guide/#it-and-specify
564
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IsExpectedSpecify
565
+
566
+ RSpec/ItBehavesLike:
567
+ Description: Checks that only one `it_behaves_like` style is used.
77
568
  Enabled: true
569
+ EnforcedStyle: it_behaves_like
570
+ SupportedStyles:
571
+ - it_behaves_like
572
+ - it_should_behave_like
573
+ VersionAdded: '1.13'
574
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
575
+
576
+ RSpec/IteratedExpectation:
577
+ Description: Check that `all` matcher is used instead of iterating over an array.
578
+ Enabled: true
579
+ VersionAdded: '1.14'
580
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
581
+
582
+ RSpec/LeadingSubject:
583
+ Description: Enforce that subject is the first definition in the test.
584
+ Enabled: true
585
+ VersionAdded: '1.7'
586
+ VersionChanged: '1.14'
587
+ StyleGuide: https://rspec.rubystyle.guide/#leading-subject
588
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
589
+
590
+ RSpec/LeakyConstantDeclaration:
591
+ Description: Checks that no class, module, or constant is declared.
592
+ Enabled: true
593
+ VersionAdded: '1.35'
594
+ StyleGuide: https://rspec.rubystyle.guide/#declare-constants
595
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
596
+
597
+ RSpec/LetBeforeExamples:
598
+ Description: Checks for `let` definitions that come after an example.
599
+ Enabled: true
600
+ AutoCorrect: contextual
601
+ VersionAdded: '1.16'
602
+ VersionChanged: '2.31'
603
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
78
604
 
79
605
  RSpec/LetSetup:
80
606
  Description: Checks unreferenced `let!` calls being used for test setup.
81
607
  Enabled: true
608
+ VersionAdded: '1.7'
609
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
82
610
 
83
- RSpec/LeadingSubject:
84
- Description: Checks for `subject` definitions that come after `let` definitions.
611
+ RSpec/MatchArray:
612
+ Description: Checks where `match_array` is used.
85
613
  Enabled: true
614
+ VersionAdded: '2.19'
615
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MatchArray
86
616
 
87
- RSpec/FilePath:
88
- Description: Checks that spec file paths are consistent with the test subject.
617
+ RSpec/MessageChain:
618
+ Description: Check that chains of messages are not being stubbed.
89
619
  Enabled: true
90
- CustomTransform:
91
- RuboCop: rubocop
92
- RSpec: rspec
620
+ VersionAdded: '1.7'
621
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
93
622
 
94
- RSpec/VerifiedDoubles:
95
- Description: Prefer using verifying doubles over normal doubles.
623
+ RSpec/MessageExpectation:
624
+ Description: Checks for consistent message expectation style.
625
+ Enabled: false
626
+ EnforcedStyle: allow
627
+ SupportedStyles:
628
+ - allow
629
+ - expect
630
+ VersionAdded: '1.7'
631
+ VersionChanged: '1.8'
632
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
633
+
634
+ RSpec/MessageSpies:
635
+ Description: Checks that message expectations are set using spies.
96
636
  Enabled: true
97
- IgnoreSymbolicNames: false
637
+ EnforcedStyle: have_received
638
+ SupportedStyles:
639
+ - have_received
640
+ - receive
641
+ VersionAdded: '1.9'
642
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
643
+
644
+ RSpec/MetadataStyle:
645
+ Description: Use consistent metadata style.
646
+ Enabled: true
647
+ EnforcedStyle: symbol
648
+ SupportedStyles:
649
+ - hash
650
+ - symbol
651
+ VersionAdded: '2.24'
652
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MetadataStyle
653
+
654
+ RSpec/MissingExampleGroupArgument:
655
+ Description: Checks that the first argument to an example group is not empty.
656
+ Enabled: true
657
+ VersionAdded: '1.28'
658
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
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
+
666
+ RSpec/MultipleDescribes:
667
+ Description: Checks for multiple top-level example groups.
668
+ Enabled: true
669
+ VersionAdded: '1.0'
670
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
671
+
672
+ RSpec/MultipleExpectations:
673
+ Description: Checks if examples contain too many `expect` calls.
674
+ Enabled: true
675
+ Max: 1
676
+ VersionAdded: '1.7'
677
+ VersionChanged: '1.21'
678
+ StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example
679
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
680
+
681
+ RSpec/MultipleMemoizedHelpers:
682
+ Description: Checks if example groups contain too many `let` and `subject` calls.
683
+ Enabled: true
684
+ AllowSubject: true
685
+ Max: 5
686
+ VersionAdded: '1.43'
687
+ StyleGuide: https://rspec.rubystyle.guide/#let-blocks
688
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
689
+
690
+ RSpec/MultipleSubjects:
691
+ Description: Checks if an example group defines `subject` multiple times.
692
+ Enabled: true
693
+ VersionAdded: '1.16'
694
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
695
+
696
+ RSpec/NamedSubject:
697
+ Description: Checks for explicitly referenced test subjects.
698
+ Enabled: true
699
+ EnforcedStyle: always
700
+ SupportedStyles:
701
+ - always
702
+ - named_only
703
+ IgnoreSharedExamples: true
704
+ VersionAdded: 1.5.3
705
+ VersionChanged: '2.15'
706
+ StyleGuide: https://rspec.rubystyle.guide/#use-subject
707
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
708
+
709
+ RSpec/NestedGroups:
710
+ Description: Checks for nested example groups.
711
+ Enabled: true
712
+ Max: 3
713
+ AllowedGroups: []
714
+ VersionAdded: '1.7'
715
+ VersionChanged: '2.13'
716
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
717
+
718
+ RSpec/NoExpectationExample:
719
+ Description: Checks if an example contains any expectation.
720
+ Enabled: true
721
+ Safe: false
722
+ VersionAdded: '2.13'
723
+ VersionChanged: '2.14'
724
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample
725
+ AllowedPatterns:
726
+ - "^expect_"
727
+ - "^assert_"
98
728
 
99
729
  RSpec/NotToNot:
100
730
  Description: Checks for consistent method usage for negating expectations.
731
+ Enabled: true
101
732
  EnforcedStyle: not_to
102
733
  SupportedStyles:
103
- - not_to
104
- - to_not
734
+ - not_to
735
+ - to_not
736
+ VersionAdded: '1.4'
737
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
738
+
739
+ RSpec/OverwritingSetup:
740
+ Description: Checks if there is a let/subject that overwrites an existing one.
105
741
  Enabled: true
742
+ VersionAdded: '1.14'
743
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
106
744
 
107
- RSpec/Focus:
108
- Description: Checks if examples are focused.
745
+ RSpec/Pending:
746
+ Description: Checks for any pending or skipped examples.
747
+ Enabled: false
748
+ VersionAdded: '1.25'
749
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
750
+
751
+ RSpec/PendingWithoutReason:
752
+ Description: Checks for pending or skipped examples without reason.
109
753
  Enabled: true
754
+ VersionAdded: '2.16'
755
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
110
756
 
111
- RSpec/ExampleLength:
112
- Description: Checks for long examples.
757
+ RSpec/PredicateMatcher:
758
+ Description: Prefer using predicate matcher over using predicate method directly.
113
759
  Enabled: true
114
- Max: 5
760
+ Strict: true
761
+ EnforcedStyle: inflected
762
+ AllowedExplicitMatchers: []
763
+ SupportedStyles:
764
+ - inflected
765
+ - explicit
766
+ SafeAutoCorrect: false
767
+ VersionAdded: '1.16'
768
+ StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers
769
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
115
770
 
116
- RSpec/MessageExpectation:
117
- Description: Checks for consistent message expectation style.
771
+ RSpec/ReceiveCounts:
772
+ Description: Check for `once` and `twice` receive counts matchers usage.
118
773
  Enabled: true
119
- EnforcedStyle: allow
774
+ VersionAdded: '1.26'
775
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
776
+
777
+ RSpec/ReceiveMessages:
778
+ Description: Checks for multiple messages stubbed on the same object.
779
+ Enabled: true
780
+ SafeAutoCorrect: false
781
+ VersionAdded: '2.23'
782
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
783
+
784
+ RSpec/ReceiveNever:
785
+ Description: Prefer `not_to receive(...)` over `receive(...).never`.
786
+ Enabled: true
787
+ VersionAdded: '1.28'
788
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
789
+
790
+ RSpec/RedundantAround:
791
+ Description: Remove redundant `around` hook.
792
+ Enabled: true
793
+ VersionAdded: '2.19'
794
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantAround
795
+
796
+ RSpec/RedundantPredicateMatcher:
797
+ Description: Checks for redundant predicate matcher.
798
+ Enabled: true
799
+ VersionAdded: '2.26'
800
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RedundantPredicateMatcher
801
+
802
+ RSpec/RemoveConst:
803
+ Description: Checks that `remove_const` is not used in specs.
804
+ Enabled: true
805
+ VersionAdded: '2.26'
806
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RemoveConst
807
+
808
+ RSpec/RepeatedDescription:
809
+ Description: Check for repeated description strings in example groups.
810
+ Enabled: true
811
+ VersionAdded: '1.9'
812
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
813
+
814
+ RSpec/RepeatedExample:
815
+ Description: Check for repeated examples within example groups.
816
+ Enabled: true
817
+ VersionAdded: '1.10'
818
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
819
+
820
+ RSpec/RepeatedExampleGroupBody:
821
+ Description: Check for repeated describe and context block body.
822
+ Enabled: true
823
+ VersionAdded: '1.38'
824
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
825
+
826
+ RSpec/RepeatedExampleGroupDescription:
827
+ Description: Check for repeated example group descriptions.
828
+ Enabled: true
829
+ VersionAdded: '1.38'
830
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
831
+
832
+ RSpec/RepeatedIncludeExample:
833
+ Description: Check for repeated include of shared examples.
834
+ Enabled: true
835
+ VersionAdded: '1.44'
836
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
837
+
838
+ RSpec/RepeatedSubjectCall:
839
+ Description: Checks for repeated calls to subject missing that it is memoized.
840
+ Enabled: true
841
+ VersionAdded: '2.27'
842
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedSubjectCall
843
+
844
+ RSpec/ReturnFromStub:
845
+ Description: Checks for consistent style of stub's return setting.
846
+ Enabled: true
847
+ EnforcedStyle: and_return
120
848
  SupportedStyles:
121
- - allow
122
- - expect
849
+ - and_return
850
+ - block
851
+ VersionAdded: '1.16'
852
+ VersionChanged: '1.22'
853
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
123
854
 
124
- RSpec/NamedSubject:
125
- Description: Checks for explicitly referenced test subjects.
855
+ RSpec/ScatteredLet:
856
+ Description: Checks for let scattered across the example group.
857
+ Enabled: true
858
+ AutoCorrect: contextual
859
+ VersionAdded: '1.14'
860
+ VersionChanged: '2.31'
861
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
862
+
863
+ RSpec/ScatteredSetup:
864
+ Description: Checks for setup scattered across multiple hooks in an example group.
865
+ Enabled: true
866
+ AutoCorrect: contextual
867
+ VersionAdded: '1.10'
868
+ VersionChanged: '2.31'
869
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
870
+
871
+ RSpec/SharedContext:
872
+ Description: Checks for proper shared_context and shared_examples usage.
873
+ Enabled: true
874
+ VersionAdded: '1.13'
875
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
876
+
877
+ RSpec/SharedExamples:
878
+ Description: Checks for consistent style for shared example names.
879
+ Enabled: true
880
+ EnforcedStyle: string
881
+ SupportedStyles:
882
+ - string
883
+ - symbol
884
+ VersionAdded: '1.25'
885
+ VersionChanged: '2.26'
886
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
887
+
888
+ RSpec/SingleArgumentMessageChain:
889
+ Description: Checks that chains of messages contain more than one element.
890
+ Enabled: true
891
+ VersionAdded: '1.9'
892
+ VersionChanged: '1.10'
893
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
894
+
895
+ RSpec/SkipBlockInsideExample:
896
+ Description: Checks for passing a block to `skip` within examples.
897
+ Enabled: true
898
+ VersionAdded: '2.19'
899
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SkipBlockInsideExample
900
+
901
+ RSpec/SortMetadata:
902
+ Description: Sort RSpec metadata alphabetically.
903
+ Enabled: true
904
+ VersionAdded: '2.14'
905
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata
906
+
907
+ RSpec/SpecFilePathFormat:
908
+ Description: Checks that spec file paths are consistent and well-formed.
126
909
  Enabled: true
910
+ Include:
911
+ - "**/*_spec.rb"
912
+ Exclude:
913
+ - "**/spec/routing/**/*"
914
+ CustomTransform:
915
+ RuboCop: rubocop
916
+ RSpec: rspec
917
+ IgnoreMethods: false
918
+ IgnoreMetadata:
919
+ type: routing
920
+ VersionAdded: '2.24'
921
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathFormat
922
+
923
+ RSpec/SpecFilePathSuffix:
924
+ Description: Checks that spec file paths suffix are consistent and well-formed.
925
+ Enabled: true
926
+ VersionAdded: '2.24'
927
+ Include:
928
+ - "**/*_spec*rb*"
929
+ - "**/spec/**/*"
930
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SpecFilePathSuffix
931
+
932
+ RSpec/StubbedMock:
933
+ Description: Checks that message expectations do not have a configured response.
934
+ Enabled: true
935
+ VersionAdded: '1.44'
936
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
937
+
938
+ RSpec/SubjectDeclaration:
939
+ Description: Ensure that subject is defined using subject helper.
940
+ Enabled: true
941
+ VersionAdded: '2.5'
942
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
127
943
 
128
944
  RSpec/SubjectStub:
129
945
  Description: Checks for stubbed test subjects.
130
946
  Enabled: true
947
+ VersionAdded: '1.7'
948
+ VersionChanged: '2.8'
949
+ StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject
950
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
951
+
952
+ RSpec/UndescriptiveLiteralsDescription:
953
+ Description: Description should be descriptive.
954
+ Enabled: true
955
+ VersionAdded: '2.29'
956
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UndescriptiveLiteralsDescription
957
+
958
+ RSpec/UnspecifiedException:
959
+ Description: Checks for a specified error in checking raised errors.
960
+ Enabled: true
961
+ VersionAdded: '1.30'
962
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
963
+
964
+ RSpec/VariableDefinition:
965
+ Description: Checks that memoized helpers names are symbols or strings.
966
+ Enabled: true
967
+ EnforcedStyle: symbols
968
+ SupportedStyles:
969
+ - symbols
970
+ - strings
971
+ VersionAdded: '1.40'
972
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
973
+
974
+ RSpec/VariableName:
975
+ Description: Checks that memoized helper names use the configured style.
976
+ Enabled: true
977
+ EnforcedStyle: snake_case
978
+ SupportedStyles:
979
+ - snake_case
980
+ - camelCase
981
+ AllowedPatterns: []
982
+ VersionAdded: '1.40'
983
+ VersionChanged: '2.13'
984
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
985
+
986
+ RSpec/VerifiedDoubleReference:
987
+ Description: Checks for consistent verified double reference style.
988
+ Enabled: true
989
+ SafeAutoCorrect: false
990
+ EnforcedStyle: constant
991
+ SupportedStyles:
992
+ - constant
993
+ - string
994
+ VersionAdded: 2.10.0
995
+ VersionChanged: '2.12'
996
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference
997
+
998
+ RSpec/VerifiedDoubles:
999
+ Description: Prefer using verifying doubles over normal doubles.
1000
+ Enabled: true
1001
+ IgnoreNameless: true
1002
+ IgnoreSymbolicNames: false
1003
+ VersionAdded: 1.2.1
1004
+ VersionChanged: '1.5'
1005
+ StyleGuide: https://rspec.rubystyle.guide/#doubles
1006
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
1007
+
1008
+ RSpec/VoidExpect:
1009
+ Description: Checks void `expect()`.
1010
+ Enabled: true
1011
+ VersionAdded: '1.16'
1012
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
1013
+
1014
+ RSpec/Yield:
1015
+ Description: Checks for calling a block within a stub.
1016
+ Enabled: true
1017
+ VersionAdded: '1.32'
1018
+ Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield