rubocop-rspec 2.4.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +2 -4
- data/config/default.yml +187 -92
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +7 -7
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +2 -23
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +3 -2
- data/lib/rubocop/cop/rspec/empty_hook.rb +4 -1
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +3 -9
- data/lib/rubocop/cop/rspec/example_wording.rb +3 -0
- data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +100 -0
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +4 -3
- data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +107 -0
- data/lib/rubocop/cop/rspec/hook_argument.rb +1 -1
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +2 -0
- data/lib/rubocop/cop/rspec/leading_subject.rb +3 -7
- data/lib/rubocop/cop/rspec/mixin/inside_example_group.rb +29 -0
- data/lib/rubocop/cop/rspec/nested_groups.rb +1 -1
- data/lib/rubocop/cop/rspec/subject_declaration.rb +47 -0
- data/lib/rubocop/cop/rspec/subject_stub.rb +44 -18
- data/lib/rubocop/cop/rspec/variable_definition.rb +19 -2
- data/lib/rubocop/cop/rspec/yield.rb +1 -1
- data/lib/rubocop/cop/rspec_cops.rb +3 -0
- data/lib/rubocop/rspec/align_let_brace.rb +2 -1
- data/lib/rubocop/rspec/config_formatter.rb +6 -4
- data/lib/rubocop/rspec/factory_bot/language.rb +17 -0
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop-rspec.rb +5 -2
- metadata +16 -24
data/config/default.yml
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
---
|
2
2
|
RSpec:
|
3
3
|
Enabled: true
|
4
|
-
|
4
|
+
StyleGuideBaseURL: https://rspec.rubystyle.guide
|
5
|
+
Include: &1
|
5
6
|
- "**/*_spec.rb"
|
6
7
|
- "**/spec/**/*"
|
7
|
-
Language:
|
8
|
+
Language: &2
|
9
|
+
inherit_mode:
|
10
|
+
merge:
|
11
|
+
- Expectations
|
12
|
+
- Helpers
|
13
|
+
- Hooks
|
14
|
+
- HookScopes
|
15
|
+
- Runners
|
16
|
+
- Subjects
|
8
17
|
ExampleGroups:
|
18
|
+
inherit_mode:
|
19
|
+
merge:
|
20
|
+
- Regular
|
21
|
+
- Skipped
|
22
|
+
- Focused
|
9
23
|
Regular:
|
10
24
|
- describe
|
11
25
|
- context
|
@@ -20,6 +34,12 @@ RSpec:
|
|
20
34
|
- fcontext
|
21
35
|
- ffeature
|
22
36
|
Examples:
|
37
|
+
inherit_mode:
|
38
|
+
merge:
|
39
|
+
- Regular
|
40
|
+
- Skipped
|
41
|
+
- Focused
|
42
|
+
- Pending
|
23
43
|
Regular:
|
24
44
|
- it
|
25
45
|
- specify
|
@@ -62,6 +82,10 @@ RSpec:
|
|
62
82
|
- all
|
63
83
|
- suite
|
64
84
|
Includes:
|
85
|
+
inherit_mode:
|
86
|
+
merge:
|
87
|
+
- Examples
|
88
|
+
- Context
|
65
89
|
Examples:
|
66
90
|
- it_behaves_like
|
67
91
|
- it_should_behave_like
|
@@ -73,6 +97,10 @@ RSpec:
|
|
73
97
|
- to_not
|
74
98
|
- not_to
|
75
99
|
SharedGroups:
|
100
|
+
inherit_mode:
|
101
|
+
merge:
|
102
|
+
- Examples
|
103
|
+
- Context
|
76
104
|
Examples:
|
77
105
|
- shared_examples
|
78
106
|
- shared_examples_for
|
@@ -86,37 +114,39 @@ RSpec/AlignLeftLetBrace:
|
|
86
114
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
87
115
|
Enabled: false
|
88
116
|
VersionAdded: '1.16'
|
89
|
-
|
117
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
90
118
|
|
91
119
|
RSpec/AlignRightLetBrace:
|
92
120
|
Description: Checks that right braces for adjacent single line lets are aligned.
|
93
121
|
Enabled: false
|
94
122
|
VersionAdded: '1.16'
|
95
|
-
|
123
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
96
124
|
|
97
125
|
RSpec/AnyInstance:
|
98
126
|
Description: Check that instances are not being stubbed globally.
|
99
127
|
Enabled: true
|
100
128
|
VersionAdded: '1.4'
|
101
|
-
StyleGuide: https://
|
129
|
+
StyleGuide: https://rspec.rubystyle.guide/#any_instance_of
|
130
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
102
131
|
|
103
132
|
RSpec/AroundBlock:
|
104
133
|
Description: Checks that around blocks actually run the test.
|
105
134
|
Enabled: true
|
106
135
|
VersionAdded: '1.11'
|
107
|
-
|
136
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
108
137
|
|
109
138
|
RSpec/Be:
|
110
139
|
Description: Check for expectations where `be` is used without argument.
|
111
140
|
Enabled: true
|
112
141
|
VersionAdded: '1.25'
|
113
|
-
StyleGuide: https://
|
142
|
+
StyleGuide: https://rspec.rubystyle.guide/#be-matcher
|
143
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
114
144
|
|
115
145
|
RSpec/BeEql:
|
116
146
|
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
117
147
|
Enabled: true
|
118
148
|
VersionAdded: '1.7'
|
119
|
-
|
149
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
120
150
|
|
121
151
|
RSpec/BeforeAfterAll:
|
122
152
|
Description: Check that before/after(:all) isn't being used.
|
@@ -126,13 +156,15 @@ RSpec/BeforeAfterAll:
|
|
126
156
|
- spec/rails_helper.rb
|
127
157
|
- spec/support/**/*.rb
|
128
158
|
VersionAdded: '1.12'
|
129
|
-
StyleGuide: https://
|
159
|
+
StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope
|
160
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
130
161
|
|
131
162
|
RSpec/ContextMethod:
|
132
163
|
Description: "`context` should not be used for specifying methods."
|
133
164
|
Enabled: true
|
134
165
|
VersionAdded: '1.36'
|
135
|
-
StyleGuide: https://
|
166
|
+
StyleGuide: https://rspec.rubystyle.guide/#example-group-naming
|
167
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
136
168
|
|
137
169
|
RSpec/ContextWording:
|
138
170
|
Description: Checks that `context` docstring starts with an allowed prefix.
|
@@ -143,11 +175,18 @@ RSpec/ContextWording:
|
|
143
175
|
- without
|
144
176
|
VersionAdded: '1.20'
|
145
177
|
VersionChanged: 1.20.1
|
146
|
-
StyleGuide: https://
|
178
|
+
StyleGuide: https://rspec.rubystyle.guide/#context-descriptions
|
179
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
147
180
|
|
148
181
|
RSpec/DescribeClass:
|
149
182
|
Description: Check that the first argument to the top-level describe is a constant.
|
150
183
|
Enabled: true
|
184
|
+
Exclude:
|
185
|
+
- "**/spec/features/**/*"
|
186
|
+
- "**/spec/requests/**/*"
|
187
|
+
- "**/spec/routing/**/*"
|
188
|
+
- "**/spec/system/**/*"
|
189
|
+
- "**/spec/views/**/*"
|
151
190
|
IgnoredMetadata:
|
152
191
|
type:
|
153
192
|
- channel
|
@@ -163,21 +202,22 @@ RSpec/DescribeClass:
|
|
163
202
|
- system
|
164
203
|
- mailbox
|
165
204
|
- aruba
|
205
|
+
- task
|
166
206
|
VersionAdded: '1.0'
|
167
|
-
VersionChanged: '
|
168
|
-
|
207
|
+
VersionChanged: '2.7'
|
208
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
169
209
|
|
170
210
|
RSpec/DescribeMethod:
|
171
211
|
Description: Checks that the second argument to `describe` specifies a method.
|
172
212
|
Enabled: true
|
173
213
|
VersionAdded: '1.0'
|
174
|
-
|
214
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
175
215
|
|
176
216
|
RSpec/DescribeSymbol:
|
177
217
|
Description: Avoid describing symbols.
|
178
218
|
Enabled: true
|
179
219
|
VersionAdded: '1.15'
|
180
|
-
|
220
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
181
221
|
|
182
222
|
RSpec/DescribedClass:
|
183
223
|
Description: Checks that tests use `described_class`.
|
@@ -190,64 +230,69 @@ RSpec/DescribedClass:
|
|
190
230
|
SafeAutoCorrect: false
|
191
231
|
VersionAdded: '1.0'
|
192
232
|
VersionChanged: '1.11'
|
193
|
-
|
233
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
194
234
|
|
195
235
|
RSpec/DescribedClassModuleWrapping:
|
196
236
|
Description: Avoid opening modules and defining specs within them.
|
197
237
|
Enabled: false
|
198
238
|
VersionAdded: '1.37'
|
199
|
-
|
239
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
200
240
|
|
201
241
|
RSpec/Dialect:
|
202
242
|
Description: This cop enforces custom RSpec dialects.
|
203
243
|
Enabled: false
|
204
244
|
PreferredMethods: {}
|
205
245
|
VersionAdded: '1.33'
|
206
|
-
|
246
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
207
247
|
|
208
248
|
RSpec/EmptyExampleGroup:
|
209
249
|
Description: Checks if an example group does not include any tests.
|
210
250
|
Enabled: true
|
211
251
|
VersionAdded: '1.7'
|
212
252
|
VersionChanged: '2.0'
|
213
|
-
|
253
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
214
254
|
|
215
255
|
RSpec/EmptyHook:
|
216
256
|
Description: Checks for empty before and after hooks.
|
217
257
|
Enabled: true
|
218
258
|
VersionAdded: '1.39'
|
219
|
-
|
259
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
220
260
|
|
221
261
|
RSpec/EmptyLineAfterExample:
|
222
262
|
Description: Checks if there is an empty line after example blocks.
|
223
263
|
Enabled: true
|
224
264
|
AllowConsecutiveOneLiners: true
|
225
265
|
VersionAdded: '1.36'
|
226
|
-
StyleGuide: https://
|
266
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples
|
267
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
227
268
|
|
228
269
|
RSpec/EmptyLineAfterExampleGroup:
|
229
270
|
Description: Checks if there is an empty line after example group blocks.
|
230
271
|
Enabled: true
|
231
272
|
VersionAdded: '1.27'
|
232
|
-
StyleGuide: https://
|
273
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes
|
274
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
233
275
|
|
234
276
|
RSpec/EmptyLineAfterFinalLet:
|
235
277
|
Description: Checks if there is an empty line after the last let block.
|
236
278
|
Enabled: true
|
237
279
|
VersionAdded: '1.14'
|
238
|
-
StyleGuide: https://
|
280
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
281
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
239
282
|
|
240
283
|
RSpec/EmptyLineAfterHook:
|
241
284
|
Description: Checks if there is an empty line after hook blocks.
|
242
285
|
Enabled: true
|
243
286
|
VersionAdded: '1.27'
|
244
|
-
StyleGuide: https://
|
287
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
288
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
245
289
|
|
246
290
|
RSpec/EmptyLineAfterSubject:
|
247
291
|
Description: Checks if there is an empty line after subject block.
|
248
292
|
Enabled: true
|
249
293
|
VersionAdded: '1.14'
|
250
|
-
StyleGuide: https://
|
294
|
+
StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let
|
295
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
251
296
|
|
252
297
|
RSpec/ExampleLength:
|
253
298
|
Description: Checks for long examples.
|
@@ -256,7 +301,7 @@ RSpec/ExampleLength:
|
|
256
301
|
CountAsOne: []
|
257
302
|
VersionAdded: '1.5'
|
258
303
|
VersionChanged: '2.3'
|
259
|
-
|
304
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
260
305
|
|
261
306
|
RSpec/ExampleWithoutDescription:
|
262
307
|
Description: Checks for examples without a description.
|
@@ -267,7 +312,13 @@ RSpec/ExampleWithoutDescription:
|
|
267
312
|
- single_line_only
|
268
313
|
- disallow
|
269
314
|
VersionAdded: '1.22'
|
270
|
-
|
315
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
316
|
+
|
317
|
+
RSpec/ExcessiveDocstringSpacing:
|
318
|
+
Description: Checks for excessive whitespace in example descriptions.
|
319
|
+
Enabled: pending
|
320
|
+
VersionAdded: '2.5'
|
321
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
271
322
|
|
272
323
|
RSpec/ExampleWording:
|
273
324
|
Description: Checks for common mistakes in example descriptions.
|
@@ -280,7 +331,8 @@ RSpec/ExampleWording:
|
|
280
331
|
IgnoredWords: []
|
281
332
|
VersionAdded: '1.0'
|
282
333
|
VersionChanged: '1.2'
|
283
|
-
StyleGuide: https://
|
334
|
+
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
|
335
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
284
336
|
|
285
337
|
RSpec/ExpectActual:
|
286
338
|
Description: Checks for `expect(...)` calls containing literal values.
|
@@ -288,7 +340,7 @@ RSpec/ExpectActual:
|
|
288
340
|
Exclude:
|
289
341
|
- spec/routing/**/*
|
290
342
|
VersionAdded: '1.7'
|
291
|
-
|
343
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
292
344
|
|
293
345
|
RSpec/ExpectChange:
|
294
346
|
Description: Checks for consistent style of change matcher.
|
@@ -297,20 +349,22 @@ RSpec/ExpectChange:
|
|
297
349
|
SupportedStyles:
|
298
350
|
- method_call
|
299
351
|
- block
|
352
|
+
SafeAutoCorrect: false
|
300
353
|
VersionAdded: '1.22'
|
301
|
-
|
354
|
+
VersionChanged: '2.5'
|
355
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
302
356
|
|
303
357
|
RSpec/ExpectInHook:
|
304
358
|
Description: Do not use `expect` in hooks such as `before`.
|
305
359
|
Enabled: true
|
306
360
|
VersionAdded: '1.16'
|
307
|
-
|
361
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
308
362
|
|
309
363
|
RSpec/ExpectOutput:
|
310
364
|
Description: Checks for opportunities to use `expect { ... }.to output`.
|
311
365
|
Enabled: true
|
312
366
|
VersionAdded: '1.10'
|
313
|
-
|
367
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
314
368
|
|
315
369
|
RSpec/FilePath:
|
316
370
|
Description: Checks that spec file paths are consistent and well-formed.
|
@@ -325,14 +379,14 @@ RSpec/FilePath:
|
|
325
379
|
SpecSuffixOnly: false
|
326
380
|
VersionAdded: '1.2'
|
327
381
|
VersionChanged: '1.40'
|
328
|
-
|
382
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
329
383
|
|
330
384
|
RSpec/Focus:
|
331
385
|
Description: Checks if examples are focused.
|
332
386
|
Enabled: true
|
333
387
|
VersionAdded: '1.5'
|
334
388
|
VersionChanged: '2.1'
|
335
|
-
|
389
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
336
390
|
|
337
391
|
RSpec/HookArgument:
|
338
392
|
Description: Checks the arguments passed to `before`, `around`, and `after`.
|
@@ -343,25 +397,27 @@ RSpec/HookArgument:
|
|
343
397
|
- each
|
344
398
|
- example
|
345
399
|
VersionAdded: '1.7'
|
346
|
-
StyleGuide: https://
|
400
|
+
StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach
|
401
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
347
402
|
|
348
403
|
RSpec/HooksBeforeExamples:
|
349
404
|
Description: Checks for before/around/after hooks that come after an example.
|
350
405
|
Enabled: true
|
351
406
|
VersionAdded: '1.29'
|
352
|
-
|
407
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
353
408
|
|
354
409
|
RSpec/IdenticalEqualityAssertion:
|
355
410
|
Description: Checks for equality assertions with identical expressions on both sides.
|
356
411
|
Enabled: pending
|
357
412
|
VersionAdded: '2.4'
|
358
|
-
|
413
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
|
359
414
|
|
360
415
|
RSpec/ImplicitBlockExpectation:
|
361
416
|
Description: Check that implicit block expectation syntax is not used.
|
362
417
|
Enabled: true
|
363
418
|
VersionAdded: '1.35'
|
364
|
-
StyleGuide: https://
|
419
|
+
StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations
|
420
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
365
421
|
|
366
422
|
RSpec/ImplicitExpect:
|
367
423
|
Description: Check that a consistent implicit expectation style is used.
|
@@ -371,7 +427,8 @@ RSpec/ImplicitExpect:
|
|
371
427
|
- is_expected
|
372
428
|
- should
|
373
429
|
VersionAdded: '1.8'
|
374
|
-
StyleGuide: https://
|
430
|
+
StyleGuide: https://rspec.rubystyle.guide/#use-expect
|
431
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
375
432
|
|
376
433
|
RSpec/ImplicitSubject:
|
377
434
|
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
@@ -383,13 +440,13 @@ RSpec/ImplicitSubject:
|
|
383
440
|
- disallow
|
384
441
|
VersionAdded: '1.29'
|
385
442
|
VersionChanged: '1.30'
|
386
|
-
|
443
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
387
444
|
|
388
445
|
RSpec/InstanceSpy:
|
389
446
|
Description: Checks for `instance_double` used with `have_received`.
|
390
447
|
Enabled: true
|
391
448
|
VersionAdded: '1.12'
|
392
|
-
|
449
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
393
450
|
|
394
451
|
RSpec/InstanceVariable:
|
395
452
|
Description: Checks for instance variable usage in specs.
|
@@ -397,7 +454,8 @@ RSpec/InstanceVariable:
|
|
397
454
|
AssignmentOnly: false
|
398
455
|
VersionAdded: '1.0'
|
399
456
|
VersionChanged: '1.7'
|
400
|
-
StyleGuide: https://
|
457
|
+
StyleGuide: https://rspec.rubystyle.guide/#instance-variables
|
458
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
401
459
|
|
402
460
|
RSpec/ItBehavesLike:
|
403
461
|
Description: Checks that only one `it_behaves_like` style is used.
|
@@ -407,45 +465,47 @@ RSpec/ItBehavesLike:
|
|
407
465
|
- it_behaves_like
|
408
466
|
- it_should_behave_like
|
409
467
|
VersionAdded: '1.13'
|
410
|
-
|
468
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
411
469
|
|
412
470
|
RSpec/IteratedExpectation:
|
413
471
|
Description: Check that `all` matcher is used instead of iterating over an array.
|
414
472
|
Enabled: true
|
415
473
|
VersionAdded: '1.14'
|
416
|
-
|
474
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
417
475
|
|
418
476
|
RSpec/LeadingSubject:
|
419
477
|
Description: Enforce that subject is the first definition in the test.
|
420
478
|
Enabled: true
|
421
479
|
VersionAdded: '1.7'
|
422
480
|
VersionChanged: '1.14'
|
423
|
-
StyleGuide: https://
|
481
|
+
StyleGuide: https://rspec.rubystyle.guide/#leading-subject
|
482
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
424
483
|
|
425
484
|
RSpec/LeakyConstantDeclaration:
|
426
485
|
Description: Checks that no class, module, or constant is declared.
|
427
486
|
Enabled: true
|
428
487
|
VersionAdded: '1.35'
|
429
|
-
StyleGuide: https://
|
488
|
+
StyleGuide: https://rspec.rubystyle.guide/#declare-constants
|
489
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
430
490
|
|
431
491
|
RSpec/LetBeforeExamples:
|
432
492
|
Description: Checks for `let` definitions that come after an example.
|
433
493
|
Enabled: true
|
434
494
|
VersionAdded: '1.16'
|
435
495
|
VersionChanged: '1.22'
|
436
|
-
|
496
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
437
497
|
|
438
498
|
RSpec/LetSetup:
|
439
499
|
Description: Checks unreferenced `let!` calls being used for test setup.
|
440
500
|
Enabled: true
|
441
501
|
VersionAdded: '1.7'
|
442
|
-
|
502
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
443
503
|
|
444
504
|
RSpec/MessageChain:
|
445
505
|
Description: Check that chains of messages are not being stubbed.
|
446
506
|
Enabled: true
|
447
507
|
VersionAdded: '1.7'
|
448
|
-
|
508
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
449
509
|
|
450
510
|
RSpec/MessageExpectation:
|
451
511
|
Description: Checks for consistent message expectation style.
|
@@ -456,7 +516,7 @@ RSpec/MessageExpectation:
|
|
456
516
|
- expect
|
457
517
|
VersionAdded: '1.7'
|
458
518
|
VersionChanged: '1.8'
|
459
|
-
|
519
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
460
520
|
|
461
521
|
RSpec/MessageSpies:
|
462
522
|
Description: Checks that message expectations are set using spies.
|
@@ -466,19 +526,19 @@ RSpec/MessageSpies:
|
|
466
526
|
- have_received
|
467
527
|
- receive
|
468
528
|
VersionAdded: '1.9'
|
469
|
-
|
529
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
470
530
|
|
471
531
|
RSpec/MissingExampleGroupArgument:
|
472
532
|
Description: Checks that the first argument to an example group is not empty.
|
473
533
|
Enabled: true
|
474
534
|
VersionAdded: '1.28'
|
475
|
-
|
535
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
476
536
|
|
477
537
|
RSpec/MultipleDescribes:
|
478
538
|
Description: Checks for multiple top-level example groups.
|
479
539
|
Enabled: true
|
480
540
|
VersionAdded: '1.0'
|
481
|
-
|
541
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
482
542
|
|
483
543
|
RSpec/MultipleExpectations:
|
484
544
|
Description: Checks if examples contain too many `expect` calls.
|
@@ -486,7 +546,8 @@ RSpec/MultipleExpectations:
|
|
486
546
|
Max: 1
|
487
547
|
VersionAdded: '1.7'
|
488
548
|
VersionChanged: '1.21'
|
489
|
-
StyleGuide: https://
|
549
|
+
StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example
|
550
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
490
551
|
|
491
552
|
RSpec/MultipleMemoizedHelpers:
|
492
553
|
Description: Checks if example groups contain too many `let` and `subject` calls.
|
@@ -494,20 +555,22 @@ RSpec/MultipleMemoizedHelpers:
|
|
494
555
|
AllowSubject: true
|
495
556
|
Max: 5
|
496
557
|
VersionAdded: '1.43'
|
497
|
-
StyleGuide: https://
|
558
|
+
StyleGuide: https://rspec.rubystyle.guide/#let-blocks
|
559
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
|
498
560
|
|
499
561
|
RSpec/MultipleSubjects:
|
500
562
|
Description: Checks if an example group defines `subject` multiple times.
|
501
563
|
Enabled: true
|
502
564
|
VersionAdded: '1.16'
|
503
|
-
|
565
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
504
566
|
|
505
567
|
RSpec/NamedSubject:
|
506
568
|
Description: Checks for explicitly referenced test subjects.
|
507
569
|
Enabled: true
|
508
570
|
IgnoreSharedExamples: true
|
509
571
|
VersionAdded: 1.5.3
|
510
|
-
StyleGuide: https://
|
572
|
+
StyleGuide: https://rspec.rubystyle.guide/#use-subject
|
573
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
511
574
|
|
512
575
|
RSpec/NestedGroups:
|
513
576
|
Description: Checks for nested example groups.
|
@@ -515,7 +578,7 @@ RSpec/NestedGroups:
|
|
515
578
|
Max: 3
|
516
579
|
VersionAdded: '1.7'
|
517
580
|
VersionChanged: '1.10'
|
518
|
-
|
581
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
519
582
|
|
520
583
|
RSpec/NotToNot:
|
521
584
|
Description: Checks for consistent method usage for negating expectations.
|
@@ -525,19 +588,19 @@ RSpec/NotToNot:
|
|
525
588
|
- not_to
|
526
589
|
- to_not
|
527
590
|
VersionAdded: '1.4'
|
528
|
-
|
591
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
529
592
|
|
530
593
|
RSpec/OverwritingSetup:
|
531
594
|
Description: Checks if there is a let/subject that overwrites an existing one.
|
532
595
|
Enabled: true
|
533
596
|
VersionAdded: '1.14'
|
534
|
-
|
597
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
535
598
|
|
536
599
|
RSpec/Pending:
|
537
600
|
Description: Checks for any pending or skipped examples.
|
538
601
|
Enabled: false
|
539
602
|
VersionAdded: '1.25'
|
540
|
-
|
603
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
541
604
|
|
542
605
|
RSpec/PredicateMatcher:
|
543
606
|
Description: Prefer using predicate matcher over using predicate method directly.
|
@@ -550,49 +613,50 @@ RSpec/PredicateMatcher:
|
|
550
613
|
- explicit
|
551
614
|
SafeAutoCorrect: false
|
552
615
|
VersionAdded: '1.16'
|
553
|
-
StyleGuide: https://
|
616
|
+
StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers
|
617
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
554
618
|
|
555
619
|
RSpec/ReceiveCounts:
|
556
620
|
Description: Check for `once` and `twice` receive counts matchers usage.
|
557
621
|
Enabled: true
|
558
622
|
VersionAdded: '1.26'
|
559
|
-
|
623
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
560
624
|
|
561
625
|
RSpec/ReceiveNever:
|
562
626
|
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
563
627
|
Enabled: true
|
564
628
|
VersionAdded: '1.28'
|
565
|
-
|
629
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
566
630
|
|
567
631
|
RSpec/RepeatedDescription:
|
568
632
|
Description: Check for repeated description strings in example groups.
|
569
633
|
Enabled: true
|
570
634
|
VersionAdded: '1.9'
|
571
|
-
|
635
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
572
636
|
|
573
637
|
RSpec/RepeatedExample:
|
574
638
|
Description: Check for repeated examples within example groups.
|
575
639
|
Enabled: true
|
576
640
|
VersionAdded: '1.10'
|
577
|
-
|
641
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
578
642
|
|
579
643
|
RSpec/RepeatedExampleGroupBody:
|
580
644
|
Description: Check for repeated describe and context block body.
|
581
645
|
Enabled: true
|
582
646
|
VersionAdded: '1.38'
|
583
|
-
|
647
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
584
648
|
|
585
649
|
RSpec/RepeatedExampleGroupDescription:
|
586
650
|
Description: Check for repeated example group descriptions.
|
587
651
|
Enabled: true
|
588
652
|
VersionAdded: '1.38'
|
589
|
-
|
653
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
590
654
|
|
591
655
|
RSpec/RepeatedIncludeExample:
|
592
656
|
Description: Check for repeated include of shared examples.
|
593
657
|
Enabled: true
|
594
658
|
VersionAdded: '1.44'
|
595
|
-
|
659
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
|
596
660
|
|
597
661
|
RSpec/ReturnFromStub:
|
598
662
|
Description: Checks for consistent style of stub's return setting.
|
@@ -603,57 +667,65 @@ RSpec/ReturnFromStub:
|
|
603
667
|
- block
|
604
668
|
VersionAdded: '1.16'
|
605
669
|
VersionChanged: '1.22'
|
606
|
-
|
670
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
607
671
|
|
608
672
|
RSpec/ScatteredLet:
|
609
673
|
Description: Checks for let scattered across the example group.
|
610
674
|
Enabled: true
|
611
675
|
VersionAdded: '1.14'
|
612
676
|
VersionChanged: '1.39'
|
613
|
-
|
677
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
614
678
|
|
615
679
|
RSpec/ScatteredSetup:
|
616
680
|
Description: Checks for setup scattered across multiple hooks in an example group.
|
617
681
|
Enabled: true
|
618
682
|
VersionAdded: '1.10'
|
619
|
-
|
683
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
620
684
|
|
621
685
|
RSpec/SharedContext:
|
622
686
|
Description: Checks for proper shared_context and shared_examples usage.
|
623
687
|
Enabled: true
|
624
688
|
VersionAdded: '1.13'
|
625
|
-
|
689
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
626
690
|
|
627
691
|
RSpec/SharedExamples:
|
628
692
|
Description: Enforces use of string to titleize shared examples.
|
629
693
|
Enabled: true
|
630
694
|
VersionAdded: '1.25'
|
631
|
-
|
695
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
632
696
|
|
633
697
|
RSpec/SingleArgumentMessageChain:
|
634
698
|
Description: Checks that chains of messages contain more than one element.
|
635
699
|
Enabled: true
|
636
700
|
VersionAdded: '1.9'
|
637
701
|
VersionChanged: '1.10'
|
638
|
-
|
702
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
639
703
|
|
640
704
|
RSpec/StubbedMock:
|
641
705
|
Description: Checks that message expectations do not have a configured response.
|
642
706
|
Enabled: true
|
643
707
|
VersionAdded: '1.44'
|
644
|
-
|
708
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
709
|
+
|
710
|
+
RSpec/SubjectDeclaration:
|
711
|
+
Description: Ensure that subject is defined using subject helper.
|
712
|
+
Enabled: pending
|
713
|
+
VersionAdded: '2.5'
|
714
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
|
645
715
|
|
646
716
|
RSpec/SubjectStub:
|
647
717
|
Description: Checks for stubbed test subjects.
|
648
718
|
Enabled: true
|
649
719
|
VersionAdded: '1.7'
|
650
|
-
|
720
|
+
VersionChanged: '2.8'
|
721
|
+
StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject
|
722
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
651
723
|
|
652
724
|
RSpec/UnspecifiedException:
|
653
725
|
Description: Checks for a specified error in checking raised errors.
|
654
726
|
Enabled: true
|
655
727
|
VersionAdded: '1.30'
|
656
|
-
|
728
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
657
729
|
|
658
730
|
RSpec/VariableDefinition:
|
659
731
|
Description: Checks that memoized helpers names are symbols or strings.
|
@@ -663,7 +735,7 @@ RSpec/VariableDefinition:
|
|
663
735
|
- symbols
|
664
736
|
- strings
|
665
737
|
VersionAdded: '1.40'
|
666
|
-
|
738
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
667
739
|
|
668
740
|
RSpec/VariableName:
|
669
741
|
Description: Checks that memoized helper names use the configured style.
|
@@ -675,7 +747,7 @@ RSpec/VariableName:
|
|
675
747
|
IgnoredPatterns: []
|
676
748
|
VersionAdded: '1.40'
|
677
749
|
VersionChanged: '1.43'
|
678
|
-
|
750
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
679
751
|
|
680
752
|
RSpec/VerifiedDoubles:
|
681
753
|
Description: Prefer using verifying doubles over normal doubles.
|
@@ -684,26 +756,32 @@ RSpec/VerifiedDoubles:
|
|
684
756
|
IgnoreSymbolicNames: false
|
685
757
|
VersionAdded: 1.2.1
|
686
758
|
VersionChanged: '1.5'
|
687
|
-
StyleGuide: https://
|
759
|
+
StyleGuide: https://rspec.rubystyle.guide/#doubles
|
760
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
688
761
|
|
689
762
|
RSpec/VoidExpect:
|
690
763
|
Description: This cop checks void `expect()`.
|
691
764
|
Enabled: true
|
692
765
|
VersionAdded: '1.16'
|
693
|
-
|
766
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
694
767
|
|
695
768
|
RSpec/Yield:
|
696
769
|
Description: This cop checks for calling a block within a stub.
|
697
770
|
Enabled: true
|
698
771
|
VersionAdded: '1.32'
|
699
|
-
|
772
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
773
|
+
|
774
|
+
RSpec/Capybara:
|
775
|
+
Enabled: true
|
776
|
+
Include: *1
|
777
|
+
Language: *2
|
700
778
|
|
701
779
|
RSpec/Capybara/CurrentPathExpectation:
|
702
780
|
Description: Checks that no expectations are set on Capybara's `current_path`.
|
703
781
|
Enabled: true
|
704
782
|
VersionAdded: '1.18'
|
705
783
|
VersionChanged: '2.0'
|
706
|
-
|
784
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
707
785
|
|
708
786
|
RSpec/Capybara/FeatureMethods:
|
709
787
|
Description: Checks for consistent method usage in feature specs.
|
@@ -711,14 +789,19 @@ RSpec/Capybara/FeatureMethods:
|
|
711
789
|
EnabledMethods: []
|
712
790
|
VersionAdded: '1.17'
|
713
791
|
VersionChanged: '2.0'
|
714
|
-
|
792
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
715
793
|
|
716
794
|
RSpec/Capybara/VisibilityMatcher:
|
717
|
-
Description: Checks for boolean visibility in
|
795
|
+
Description: Checks for boolean visibility in Capybara finders.
|
718
796
|
Enabled: true
|
719
797
|
VersionAdded: '1.39'
|
720
798
|
VersionChanged: '2.0'
|
721
|
-
|
799
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
|
800
|
+
|
801
|
+
RSpec/FactoryBot:
|
802
|
+
Enabled: true
|
803
|
+
Include: *1
|
804
|
+
Language: *2
|
722
805
|
|
723
806
|
RSpec/FactoryBot/AttributeDefinedStatically:
|
724
807
|
Description: Always declare attribute values as blocks.
|
@@ -729,7 +812,7 @@ RSpec/FactoryBot/AttributeDefinedStatically:
|
|
729
812
|
- features/support/factories/**/*.rb
|
730
813
|
VersionAdded: '1.28'
|
731
814
|
VersionChanged: '2.0'
|
732
|
-
|
815
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
733
816
|
|
734
817
|
RSpec/FactoryBot/CreateList:
|
735
818
|
Description: Checks for create_list usage.
|
@@ -746,7 +829,7 @@ RSpec/FactoryBot/CreateList:
|
|
746
829
|
- n_times
|
747
830
|
VersionAdded: '1.25'
|
748
831
|
VersionChanged: '2.0'
|
749
|
-
|
832
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
750
833
|
|
751
834
|
RSpec/FactoryBot/FactoryClassName:
|
752
835
|
Description: Use string value when setting the class attribute explicitly.
|
@@ -757,13 +840,25 @@ RSpec/FactoryBot/FactoryClassName:
|
|
757
840
|
- features/support/factories/**/*.rb
|
758
841
|
VersionAdded: '1.37'
|
759
842
|
VersionChanged: '2.0'
|
760
|
-
|
843
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
844
|
+
|
845
|
+
RSpec/FactoryBot/SyntaxMethods:
|
846
|
+
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
847
|
+
Enabled: pending
|
848
|
+
SafeAutoCorrect: false
|
849
|
+
VersionAdded: '2.7'
|
850
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
|
851
|
+
|
852
|
+
RSpec/Rails:
|
853
|
+
Enabled: true
|
854
|
+
Include: *1
|
855
|
+
Language: *2
|
761
856
|
|
762
857
|
RSpec/Rails/AvoidSetupHook:
|
763
858
|
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
|
764
859
|
Enabled: pending
|
765
860
|
VersionAdded: '2.4'
|
766
|
-
|
861
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
|
767
862
|
|
768
863
|
RSpec/Rails/HttpStatus:
|
769
864
|
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
@@ -774,4 +869,4 @@ RSpec/Rails/HttpStatus:
|
|
774
869
|
- symbolic
|
775
870
|
VersionAdded: '1.23'
|
776
871
|
VersionChanged: '2.0'
|
777
|
-
|
872
|
+
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|