rubocop-rspec 1.37.1 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/README.md +2 -62
  5. data/config/default.yml +155 -15
  6. data/lib/rubocop-rspec.rb +3 -1
  7. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +69 -0
  8. data/lib/rubocop/cop/rspec/context_wording.rb +5 -1
  9. data/lib/rubocop/cop/rspec/cop.rb +9 -29
  10. data/lib/rubocop/cop/rspec/describe_class.rb +20 -5
  11. data/lib/rubocop/cop/rspec/describe_method.rb +0 -1
  12. data/lib/rubocop/cop/rspec/empty_hook.rb +50 -0
  13. data/lib/rubocop/cop/rspec/expect_actual.rb +27 -2
  14. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +5 -2
  15. data/lib/rubocop/cop/rspec/file_path.rb +32 -4
  16. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +3 -21
  17. data/lib/rubocop/cop/rspec/instance_variable.rb +16 -11
  18. data/lib/rubocop/cop/rspec/leading_subject.rb +3 -10
  19. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -4
  20. data/lib/rubocop/cop/rspec/let_before_examples.rb +3 -21
  21. data/lib/rubocop/cop/rspec/let_setup.rb +15 -3
  22. data/lib/rubocop/cop/rspec/named_subject.rb +6 -6
  23. data/lib/rubocop/cop/rspec/nested_groups.rb +9 -10
  24. data/lib/rubocop/cop/rspec/predicate_matcher.rb +2 -2
  25. data/lib/rubocop/cop/rspec/rails/http_status.rb +2 -0
  26. data/lib/rubocop/cop/rspec/repeated_description.rb +17 -2
  27. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +97 -0
  28. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +96 -0
  29. data/lib/rubocop/cop/rspec/return_from_stub.rb +3 -2
  30. data/lib/rubocop/cop/rspec/scattered_let.rb +13 -0
  31. data/lib/rubocop/cop/rspec/scattered_setup.rb +27 -9
  32. data/lib/rubocop/cop/rspec/shared_examples.rb +1 -0
  33. data/lib/rubocop/cop/rspec/subject_stub.rb +23 -51
  34. data/lib/rubocop/cop/rspec/variable_definition.rb +56 -0
  35. data/lib/rubocop/cop/rspec/variable_name.rb +47 -0
  36. data/lib/rubocop/cop/rspec_cops.rb +7 -1
  37. data/lib/rubocop/rspec/corrector/move_node.rb +52 -0
  38. data/lib/rubocop/rspec/description_extractor.rb +2 -6
  39. data/lib/rubocop/rspec/example.rb +1 -1
  40. data/lib/rubocop/rspec/example_group.rb +21 -49
  41. data/lib/rubocop/rspec/factory_bot.rb +7 -1
  42. data/lib/rubocop/rspec/hook.rb +44 -11
  43. data/lib/rubocop/rspec/language.rb +20 -0
  44. data/lib/rubocop/rspec/language/node_pattern.rb +5 -1
  45. data/lib/rubocop/rspec/top_level_group.rb +44 -0
  46. data/lib/rubocop/rspec/variable.rb +16 -0
  47. data/lib/rubocop/rspec/version.rb +1 -1
  48. metadata +20 -11
  49. data/lib/rubocop/rspec/util.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b83eaf98373fd696c64571d551394a287cecc7577b9b69ecf6b425a392b41e3
4
- data.tar.gz: 390966b2a4e34f20dadd3b6f162ee812a2386602b32d98de7d5fa62f63af3e3a
3
+ metadata.gz: 4899c717a87d579939d5c1420800d2fe6c150e4421908e75b9d52c57c8362e60
4
+ data.tar.gz: 1155018e6595c843c1ade5cdecb748af349c1c2f94dbcd5b17fb4a4fb5d324be
5
5
  SHA512:
6
- metadata.gz: 6e4b4c02a0fb2987cb3fab05a26f557dc8f202262dc77202a1ba82916ac27c43d88d585218f6656c86dcfb1cd2e8c467e3b8ea2a50d790957401c2499d57a7d5
7
- data.tar.gz: c496849147815725376d0bfc43c3c6da0cd544144434980460366ee013136df4203992b6fe90a31468d4529af145ee3608de1d80827bb406c69bc371cfec42af
6
+ metadata.gz: 79d9dc291018b0551b52c85dc6b09a1151356e1c85fe4e6a8a7aca5ade036be690f9b5aae7301cf232a0d067b18c0321be44f9915d5485dcaf993786ed07d328
7
+ data.tar.gz: cd9db102d912c42b484c7a514f5954b5f35d29bb7f0f3e186ed946898ba1134de5bf452611812465103aa2effc67016e4536bfc6dd365681aa90b2f4c1957f39
@@ -2,6 +2,46 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.41.0 (2020-07-03)
6
+
7
+ * Extend the list of Rails spec types for `RSpec/DescribeClass`. ([@pirj][])
8
+ * Fix `FactoryBot/AttributeDefinedStatically` to allow `#traits_for_enum` without a block. ([@harrylewis][])
9
+ * Improve the performance of `FactoryBot/AttributeDefinedStatically`, `RSpec/InstanceVariable`, `RSpec/LetSetup`, `RSpec/NestedGroups` and `RSpec/ReturnFromStub`. ([@andrykonchin][])
10
+
11
+ ## 1.40.0 (2020-06-11)
12
+
13
+ * Add new `RSpec/VariableName` cop. ([@tejasbubane][])
14
+ * Add new `RSpec/VariableDefinition` cop. ([@tejasbubane][])
15
+ * Expand `Capybara/VisibilityMatcher` to support more than just `have_selector`. ([@twalpole][])
16
+ * Add new `SpecSuffixOnly` option to `RSpec/FilePath` cop. ([@zdennis][])
17
+ * Allow `RSpec/RepeatedExampleGroupBody` to differ only by described_class. ([@robotdana][])
18
+ * Fix `RSpec/FilePath` detection across sibling directories. ([@rolfschmidt][])
19
+ * Improve the performance of `RSpec/SubjectStub` by an order of magnitude. ([@andrykonchin][])
20
+
21
+ ## 1.39.0 (2020-05-01)
22
+
23
+ * Fix `RSpec/FilePath` detection when absolute path includes test subject. ([@eitoball][])
24
+ * Add new `Capybara/VisibilityMatcher` cop. ([@aried3r][])
25
+ * Ignore String constants by `RSpec/Describe`. ([@AlexWayfer][])
26
+ * Drop support for ruby 2.3. ([@bquorning][])
27
+ * Fix multiple cops to detect `let` with proc argument. ([@tejasbubane][])
28
+ * Add autocorrect support for `RSpec/ScatteredLet`. ([@Darhazer][])
29
+ * Add new `RSpec/EmptyHook` cop. ([@tejasbubane][])
30
+
31
+ ## 1.38.1 (2020-02-15)
32
+
33
+ * Fix `RSpec/RepeatedDescription` to detect descriptions with interpolation and methods. ([@lazycoder9][])
34
+
35
+ ## 1.38.0 (2020-02-11)
36
+
37
+ * Fix `RSpec/InstanceVariable` detection inside custom matchers. ([@pirj][])
38
+ * Fix `RSpec/ScatteredSetup` to distinguish hooks with different metadata. ([@pirj][])
39
+ * Add autocorrect support for `RSpec/ExpectActual` cop. ([@dduugg][], [@pirj][])
40
+ * Add `RSpec/RepeatedExampleGroupBody` cop. ([@lazycoder9][])
41
+ * Add `RSpec/RepeatedExampleGroupDescription` cop. ([@lazycoder9][])
42
+ * Add block name and other lines to `RSpec/ScatteredSetup` message. ([@elebow][])
43
+ * Fix `RSpec/RepeatedDescription` to take into account example metadata. ([@lazycoder9][])
44
+
5
45
  ## 1.37.1 (2019-12-16)
6
46
 
7
47
  * Improve message and description of `FactoryBot/FactoryClassName`. ([@ybiquitous][])
@@ -472,3 +512,16 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
472
512
  [@mkrawc]: https://github.com/mkrawc
473
513
  [@jfragoulis]: https://github.com/jfragoulis
474
514
  [@ybiquitous]: https://github.com/ybiquitous
515
+ [@dduugg]: https://github.com/dduugg
516
+ [@lazycoder9]: https://github.com/lazycoder9
517
+ [@elebow]: https://github.com/elebow
518
+ [@eitoball]: https://github.com/eitoball
519
+ [@aried3r]: https://github.com/aried3r
520
+ [@AlexWayfer]: https://github.com/AlexWayfer
521
+ [@tejasbubane]: https://github.com/tejasbubane
522
+ [@twalpole]: https://github.com/twalpole
523
+ [@zdennis]: https://github.com/zdennis
524
+ [@robotdana]: https://github.com/robotdana
525
+ [@rolfschmidt]: https://github.com/rolfschmidt
526
+ [@andrykonchin]: https://github.com/andrykonchin
527
+ [@harrylewis]: https://github.com/harrylewis
@@ -0,0 +1,17 @@
1
+ # The RuboCop Community Code of Conduct
2
+
3
+ **Note:** We have picked the following code of conduct based on [Ruby's own
4
+ code of conduct](https://www.ruby-lang.org/en/conduct/).
5
+
6
+ This document provides a few simple community guidelines for a safe, respectful,
7
+ productive, and collaborative place for any person who is willing to contribute
8
+ to the RuboCop community. It applies to all "collaborative spaces", which are
9
+ defined as community communications channels (such as mailing lists, submitted
10
+ patches, commit comments, etc.).
11
+
12
+ * Participants will be tolerant of opposing views.
13
+ * Participants must ensure that their language and actions are free of personal
14
+ attacks and disparaging personal remarks.
15
+ * When interpreting the words and actions of others, participants should always
16
+ assume good intentions.
17
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
data/README.md CHANGED
@@ -20,7 +20,7 @@ gem install rubocop-rspec
20
20
  or if you use bundler put this in your `Gemfile`
21
21
 
22
22
  ```
23
- gem 'rubocop-rspec'
23
+ gem 'rubocop-rspec', require: false
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -67,27 +67,7 @@ rubocop-rspec is available on Code Climate as part of the rubocop engine. [Learn
67
67
 
68
68
  ## Documentation
69
69
 
70
- You can read more about RuboCop-RSpec in its [official manual](http://rubocop-rspec.readthedocs.io).
71
-
72
- ## Inspecting files that don't end with `_spec.rb`
73
-
74
- By default, `rubocop-rspec` only inspects code within paths ending in `_spec.rb` or including `spec/`. You can override this setting in your config file by specifying one or more patterns:
75
-
76
- ```yaml
77
- # Inspect all files
78
- AllCops:
79
- RSpec:
80
- Patterns:
81
- - '.+'
82
- ```
83
-
84
- ```yaml
85
- # Inspect only files ending with `_test.rb`
86
- AllCops:
87
- RSpec:
88
- Patterns:
89
- - '_test.rb$'
90
- ```
70
+ You can read more about RuboCop-RSpec in its [official manual](https://docs.rubocop.org/rubocop-rspec).
91
71
 
92
72
  ## The Cops
93
73
 
@@ -104,46 +84,6 @@ RSpec/FilePath:
104
84
  - spec/my_poorly_named_spec_file.rb
105
85
  ```
106
86
 
107
- ## Non-goals of RuboCop RSpec
108
-
109
- ### Enforcing `should` vs. `expect` syntax
110
-
111
- Enforcing
112
-
113
- ```ruby
114
- expect(calculator.compute(line_item)).to eq(5)
115
- ```
116
-
117
- over
118
-
119
- ```ruby
120
- calculator.compute(line_item).should == 5
121
- ```
122
-
123
- is a feature of RSpec itself – you can read about it in the [RSpec Documentation](https://relishapp.com/rspec/rspec-expectations/docs/syntax-configuration#disable-should-syntax)
124
-
125
- ### Enforcing an explicit RSpec receiver for top-level methods (disabling monkey patching)
126
-
127
- Enforcing
128
-
129
- ```ruby
130
- RSpec.describe MyClass do
131
- ...
132
- end
133
- ```
134
-
135
- over
136
-
137
- ```ruby
138
- describe MyClass do
139
- ...
140
- end
141
- ```
142
-
143
- can be achieved using RSpec's `disable_monkey_patching!` method, which you can read more about in the [RSpec Documentation](https://relishapp.com/rspec/rspec-core/v/3-7/docs/configuration/zero-monkey-patching-mode#monkey-patched-methods-are-undefined-with-%60disable-monkey-patching!%60). This will also prevent `should` from being defined on every object in your system.
144
-
145
- Before disabling `should` you will need all your specs to use the `expect` syntax. You can use [Transpec](http://yujinakayama.me/transpec/), which will do the conversion for you.
146
-
147
87
  ## Contributing
148
88
 
149
89
  Checkout the [contribution guidelines](.github/CONTRIBUTING.md).
@@ -13,31 +13,37 @@ AllCops:
13
13
  RSpec/AlignLeftLetBrace:
14
14
  Description: Checks that left braces for adjacent single line lets are aligned.
15
15
  Enabled: false
16
+ VersionAdded: '1.16'
16
17
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
17
18
 
18
19
  RSpec/AlignRightLetBrace:
19
20
  Description: Checks that right braces for adjacent single line lets are aligned.
20
21
  Enabled: false
22
+ VersionAdded: '1.16'
21
23
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
22
24
 
23
25
  RSpec/AnyInstance:
24
26
  Description: Check that instances are not being stubbed globally.
25
27
  Enabled: true
28
+ VersionAdded: '1.4'
26
29
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
27
30
 
28
31
  RSpec/AroundBlock:
29
32
  Description: Checks that around blocks actually run the test.
30
33
  Enabled: true
34
+ VersionAdded: '1.11'
31
35
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
32
36
 
33
37
  RSpec/Be:
34
38
  Description: Check for expectations where `be` is used without argument.
35
39
  Enabled: true
40
+ VersionAdded: '1.25'
36
41
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
37
42
 
38
43
  RSpec/BeEql:
39
44
  Description: Check for expectations where `be(...)` can replace `eql(...)`.
40
45
  Enabled: true
46
+ VersionAdded: '1.7'
41
47
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
42
48
 
43
49
  RSpec/BeforeAfterAll:
@@ -47,11 +53,13 @@ RSpec/BeforeAfterAll:
47
53
  - spec/spec_helper.rb
48
54
  - spec/rails_helper.rb
49
55
  - spec/support/**/*.rb
56
+ VersionAdded: '1.12'
50
57
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
51
58
 
52
59
  RSpec/ContextMethod:
53
60
  Description: "`context` should not be used for specifying methods."
54
61
  Enabled: true
62
+ VersionAdded: '1.36'
55
63
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
56
64
 
57
65
  RSpec/ContextWording:
@@ -61,80 +69,103 @@ RSpec/ContextWording:
61
69
  - when
62
70
  - with
63
71
  - without
72
+ VersionAdded: '1.20'
73
+ VersionChanged: 1.20.1
64
74
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
65
75
 
66
76
  RSpec/DescribeClass:
67
77
  Description: Check that the first argument to the top level describe is a constant.
68
78
  Enabled: true
79
+ VersionAdded: '1.0'
69
80
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
70
81
 
71
82
  RSpec/DescribeMethod:
72
83
  Description: Checks that the second argument to `describe` specifies a method.
73
84
  Enabled: true
85
+ VersionAdded: '1.0'
74
86
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
75
87
 
76
88
  RSpec/DescribeSymbol:
77
89
  Description: Avoid describing symbols.
78
90
  Enabled: true
91
+ VersionAdded: '1.15'
79
92
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
80
93
 
81
94
  RSpec/DescribedClass:
82
95
  Description: Checks that tests use `described_class`.
83
- SkipBlocks: false
84
96
  Enabled: true
97
+ SkipBlocks: false
85
98
  EnforcedStyle: described_class
86
99
  SupportedStyles:
87
100
  - described_class
88
101
  - explicit
102
+ SafeAutoCorrect: false
103
+ VersionAdded: '1.0'
104
+ VersionChanged: '1.11'
89
105
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
90
106
 
91
107
  RSpec/DescribedClassModuleWrapping:
92
108
  Description: Avoid opening modules and defining specs within them.
93
109
  Enabled: false
110
+ VersionAdded: '1.37'
94
111
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
95
112
 
96
113
  RSpec/Dialect:
97
114
  Description: This cop enforces custom RSpec dialects.
98
115
  Enabled: false
99
116
  PreferredMethods: {}
117
+ VersionAdded: '1.33'
100
118
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
101
119
 
102
120
  RSpec/EmptyExampleGroup:
103
121
  Description: Checks if an example group does not include any tests.
104
122
  Enabled: true
105
123
  CustomIncludeMethods: []
124
+ VersionAdded: '1.7'
106
125
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
107
126
 
127
+ RSpec/EmptyHook:
128
+ Description: Checks for empty before and after hooks.
129
+ Enabled: true
130
+ VersionAdded: '1.39'
131
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
132
+
108
133
  RSpec/EmptyLineAfterExample:
109
134
  Description: Checks if there is an empty line after example blocks.
110
135
  Enabled: true
111
136
  AllowConsecutiveOneLiners: true
137
+ VersionAdded: '1.36'
112
138
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
113
139
 
114
140
  RSpec/EmptyLineAfterExampleGroup:
115
141
  Description: Checks if there is an empty line after example group blocks.
116
142
  Enabled: true
143
+ VersionAdded: '1.27'
117
144
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
118
145
 
119
146
  RSpec/EmptyLineAfterFinalLet:
120
147
  Description: Checks if there is an empty line after the last let block.
121
148
  Enabled: true
149
+ VersionAdded: '1.14'
122
150
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
123
151
 
124
152
  RSpec/EmptyLineAfterHook:
125
153
  Description: Checks if there is an empty line after hook blocks.
126
154
  Enabled: true
155
+ VersionAdded: '1.27'
127
156
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
128
157
 
129
158
  RSpec/EmptyLineAfterSubject:
130
159
  Description: Checks if there is an empty line after subject block.
131
160
  Enabled: true
161
+ VersionAdded: '1.14'
132
162
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
133
163
 
134
164
  RSpec/ExampleLength:
135
165
  Description: Checks for long examples.
136
166
  Enabled: true
137
167
  Max: 5
168
+ VersionAdded: '1.5'
138
169
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
139
170
 
140
171
  RSpec/ExampleWithoutDescription:
@@ -145,6 +176,7 @@ RSpec/ExampleWithoutDescription:
145
176
  - always_allow
146
177
  - single_line_only
147
178
  - disallow
179
+ VersionAdded: '1.22'
148
180
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
149
181
 
150
182
  RSpec/ExampleWording:
@@ -156,6 +188,8 @@ RSpec/ExampleWording:
156
188
  have: has
157
189
  HAVE: HAS
158
190
  IgnoredWords: []
191
+ VersionAdded: '1.0'
192
+ VersionChanged: '1.2'
159
193
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
160
194
 
161
195
  RSpec/ExpectActual:
@@ -163,6 +197,7 @@ RSpec/ExpectActual:
163
197
  Enabled: true
164
198
  Exclude:
165
199
  - spec/routing/**/*
200
+ VersionAdded: '1.7'
166
201
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
167
202
 
168
203
  RSpec/ExpectChange:
@@ -172,30 +207,37 @@ RSpec/ExpectChange:
172
207
  SupportedStyles:
173
208
  - method_call
174
209
  - block
210
+ VersionAdded: '1.22'
175
211
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
176
212
 
177
213
  RSpec/ExpectInHook:
178
- Enabled: true
179
214
  Description: Do not use `expect` in hooks such as `before`.
215
+ Enabled: true
216
+ VersionAdded: '1.16'
180
217
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
181
218
 
182
219
  RSpec/ExpectOutput:
183
220
  Description: Checks for opportunities to use `expect { ... }.to output`.
184
221
  Enabled: true
222
+ VersionAdded: '1.10'
185
223
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
186
224
 
187
225
  RSpec/FilePath:
188
- Description: Checks that spec file paths are consistent with the test subject.
226
+ Description: Checks that spec file paths are consistent and well-formed.
189
227
  Enabled: true
190
228
  CustomTransform:
191
229
  RuboCop: rubocop
192
230
  RSpec: rspec
193
231
  IgnoreMethods: false
232
+ SpecSuffixOnly: false
233
+ VersionAdded: '1.2'
234
+ VersionChanged: '1.40'
194
235
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
195
236
 
196
237
  RSpec/Focus:
197
238
  Description: Checks if examples are focused.
198
239
  Enabled: true
240
+ VersionAdded: '1.5'
199
241
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
200
242
 
201
243
  RSpec/HookArgument:
@@ -206,16 +248,19 @@ RSpec/HookArgument:
206
248
  - implicit
207
249
  - each
208
250
  - example
251
+ VersionAdded: '1.7'
209
252
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
210
253
 
211
254
  RSpec/HooksBeforeExamples:
212
- Enabled: true
213
255
  Description: Checks for before/around/after hooks that come after an example.
256
+ Enabled: true
257
+ VersionAdded: '1.29'
214
258
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
215
259
 
216
260
  RSpec/ImplicitBlockExpectation:
217
261
  Description: Check that implicit block expectation syntax is not used.
218
262
  Enabled: true
263
+ VersionAdded: '1.35'
219
264
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
220
265
 
221
266
  RSpec/ImplicitExpect:
@@ -225,32 +270,39 @@ RSpec/ImplicitExpect:
225
270
  SupportedStyles:
226
271
  - is_expected
227
272
  - should
273
+ VersionAdded: '1.8'
228
274
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
229
275
 
230
276
  RSpec/ImplicitSubject:
231
- Enabled: true
232
277
  Description: Checks for usage of implicit subject (`is_expected` / `should`).
278
+ Enabled: true
233
279
  EnforcedStyle: single_line_only
234
280
  SupportedStyles:
235
281
  - single_line_only
236
282
  - single_statement_only
237
283
  - disallow
284
+ VersionAdded: '1.29'
285
+ VersionChanged: '1.30'
238
286
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
239
287
 
240
288
  RSpec/InstanceSpy:
241
289
  Description: Checks for `instance_double` used with `have_received`.
242
290
  Enabled: true
291
+ VersionAdded: '1.12'
243
292
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
244
293
 
245
294
  RSpec/InstanceVariable:
246
295
  Description: Checks for instance variable usage in specs.
247
- AssignmentOnly: false
248
296
  Enabled: true
297
+ AssignmentOnly: false
298
+ VersionAdded: '1.0'
299
+ VersionChanged: '1.7'
249
300
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
250
301
 
251
302
  RSpec/InvalidPredicateMatcher:
252
303
  Description: Checks invalid usage for predicate matcher.
253
304
  Enabled: true
305
+ VersionAdded: '1.16'
254
306
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
255
307
 
256
308
  RSpec/ItBehavesLike:
@@ -260,36 +312,45 @@ RSpec/ItBehavesLike:
260
312
  SupportedStyles:
261
313
  - it_behaves_like
262
314
  - it_should_behave_like
315
+ VersionAdded: '1.13'
263
316
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
264
317
 
265
318
  RSpec/IteratedExpectation:
266
319
  Description: Check that `all` matcher is used instead of iterating over an array.
267
320
  Enabled: true
321
+ VersionAdded: '1.14'
268
322
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
269
323
 
270
324
  RSpec/LeadingSubject:
271
325
  Description: Enforce that subject is the first definition in the test.
272
326
  Enabled: true
327
+ VersionAdded: '1.7'
328
+ VersionChanged: '1.14'
273
329
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
274
330
 
275
331
  RSpec/LeakyConstantDeclaration:
276
332
  Description: Checks that no class, module, or constant is declared.
277
333
  Enabled: true
334
+ VersionAdded: '1.35'
278
335
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
279
336
 
280
337
  RSpec/LetBeforeExamples:
281
338
  Description: Checks for `let` definitions that come after an example.
282
339
  Enabled: true
340
+ VersionAdded: '1.16'
341
+ VersionChanged: '1.22'
283
342
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
284
343
 
285
344
  RSpec/LetSetup:
286
345
  Description: Checks unreferenced `let!` calls being used for test setup.
287
346
  Enabled: true
347
+ VersionAdded: '1.7'
288
348
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
289
349
 
290
350
  RSpec/MessageChain:
291
351
  Description: Check that chains of messages are not being stubbed.
292
352
  Enabled: true
353
+ VersionAdded: '1.7'
293
354
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
294
355
 
295
356
  RSpec/MessageExpectation:
@@ -299,6 +360,8 @@ RSpec/MessageExpectation:
299
360
  SupportedStyles:
300
361
  - allow
301
362
  - expect
363
+ VersionAdded: '1.7'
364
+ VersionChanged: '1.8'
302
365
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
303
366
 
304
367
  RSpec/MessageSpies:
@@ -308,59 +371,70 @@ RSpec/MessageSpies:
308
371
  SupportedStyles:
309
372
  - have_received
310
373
  - receive
374
+ VersionAdded: '1.9'
311
375
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
312
376
 
313
377
  RSpec/MissingExampleGroupArgument:
314
378
  Description: Checks that the first argument to an example group is not empty.
315
379
  Enabled: true
380
+ VersionAdded: '1.28'
316
381
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
317
382
 
318
383
  RSpec/MultipleDescribes:
319
384
  Description: Checks for multiple top level describes.
320
385
  Enabled: true
386
+ VersionAdded: '1.0'
321
387
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
322
388
 
323
389
  RSpec/MultipleExpectations:
324
390
  Description: Checks if examples contain too many `expect` calls.
325
391
  Enabled: true
326
392
  Max: 1
327
- AggregateFailuresByDefault: false
393
+ VersionAdded: '1.7'
394
+ VersionChanged: '1.21'
328
395
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
329
396
 
330
397
  RSpec/MultipleSubjects:
331
398
  Description: Checks if an example group defines `subject` multiple times.
332
399
  Enabled: true
400
+ VersionAdded: '1.16'
333
401
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
334
402
 
335
403
  RSpec/NamedSubject:
336
404
  Description: Checks for explicitly referenced test subjects.
337
405
  Enabled: true
338
406
  IgnoreSharedExamples: true
407
+ VersionAdded: 1.5.3
339
408
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
340
409
 
341
410
  RSpec/NestedGroups:
342
411
  Description: Checks for nested example groups.
343
412
  Enabled: true
344
413
  Max: 3
414
+ VersionAdded: '1.7'
415
+ VersionChanged: '1.10'
345
416
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
346
417
 
347
418
  RSpec/NotToNot:
348
419
  Description: Checks for consistent method usage for negating expectations.
420
+ Enabled: true
349
421
  EnforcedStyle: not_to
350
422
  SupportedStyles:
351
423
  - not_to
352
424
  - to_not
353
- Enabled: true
425
+ VersionAdded: '1.4'
354
426
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
355
427
 
356
428
  RSpec/OverwritingSetup:
357
- Enabled: true
358
429
  Description: Checks if there is a let/subject that overwrites an existing one.
430
+ Enabled: true
431
+ VersionAdded: '1.14'
359
432
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
360
433
 
361
434
  RSpec/Pending:
362
- Enabled: false
363
435
  Description: Checks for any pending or skipped examples.
436
+ Enabled: false
437
+ VersionAdded: '1.25'
364
438
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
365
439
 
366
440
  RSpec/PredicateMatcher:
@@ -372,103 +446,166 @@ RSpec/PredicateMatcher:
372
446
  SupportedStyles:
373
447
  - inflected
374
448
  - explicit
449
+ SafeAutoCorrect: false
450
+ VersionAdded: '1.16'
375
451
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
376
452
 
377
453
  RSpec/ReceiveCounts:
378
- Enabled: true
379
454
  Description: Check for `once` and `twice` receive counts matchers usage.
455
+ Enabled: true
456
+ VersionAdded: '1.26'
380
457
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
381
458
 
382
459
  RSpec/ReceiveNever:
383
- Enabled: true
384
460
  Description: Prefer `not_to receive(...)` over `receive(...).never`.
461
+ Enabled: true
462
+ VersionAdded: '1.28'
385
463
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
386
464
 
387
465
  RSpec/RepeatedDescription:
388
- Enabled: true
389
466
  Description: Check for repeated description strings in example groups.
467
+ Enabled: true
468
+ VersionAdded: '1.9'
390
469
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
391
470
 
392
471
  RSpec/RepeatedExample:
393
- Enabled: true
394
472
  Description: Check for repeated examples within example groups.
473
+ Enabled: true
474
+ VersionAdded: '1.10'
395
475
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
396
476
 
397
- RSpec/ReturnFromStub:
477
+ RSpec/RepeatedExampleGroupBody:
478
+ Description: Check for repeated describe and context block body.
398
479
  Enabled: true
480
+ VersionAdded: '1.38'
481
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
482
+
483
+ RSpec/RepeatedExampleGroupDescription:
484
+ Description: Check for repeated example group descriptions.
485
+ Enabled: true
486
+ VersionAdded: '1.38'
487
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
488
+
489
+ RSpec/ReturnFromStub:
399
490
  Description: Checks for consistent style of stub's return setting.
491
+ Enabled: true
400
492
  EnforcedStyle: and_return
401
493
  SupportedStyles:
402
494
  - and_return
403
495
  - block
496
+ VersionAdded: '1.16'
497
+ VersionChanged: '1.22'
404
498
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
405
499
 
406
500
  RSpec/ScatteredLet:
407
501
  Description: Checks for let scattered across the example group.
408
502
  Enabled: true
503
+ VersionAdded: '1.14'
504
+ VersionChanged: '1.39'
409
505
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
410
506
 
411
507
  RSpec/ScatteredSetup:
412
508
  Description: Checks for setup scattered across multiple hooks in an example group.
413
509
  Enabled: true
510
+ VersionAdded: '1.10'
414
511
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
415
512
 
416
513
  RSpec/SharedContext:
417
514
  Description: Checks for proper shared_context and shared_examples usage.
418
515
  Enabled: true
516
+ VersionAdded: '1.13'
419
517
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
420
518
 
421
519
  RSpec/SharedExamples:
422
520
  Description: Enforces use of string to titleize shared examples.
423
521
  Enabled: true
522
+ VersionAdded: '1.25'
424
523
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
425
524
 
426
525
  RSpec/SingleArgumentMessageChain:
427
526
  Description: Checks that chains of messages contain more than one element.
428
527
  Enabled: true
528
+ VersionAdded: '1.9'
529
+ VersionChanged: '1.10'
429
530
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
430
531
 
431
532
  RSpec/SubjectStub:
432
533
  Description: Checks for stubbed test subjects.
433
534
  Enabled: true
535
+ VersionAdded: '1.7'
434
536
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
435
537
 
436
538
  RSpec/UnspecifiedException:
437
539
  Description: Checks for a specified error in checking raised errors.
438
540
  Enabled: true
541
+ VersionAdded: '1.30'
439
542
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
440
543
 
544
+ RSpec/VariableDefinition:
545
+ Description: Checks that memoized helpers names are symbols or strings.
546
+ Enabled: true
547
+ EnforcedStyle: symbols
548
+ SupportedStyles:
549
+ - symbols
550
+ - strings
551
+ VersionAdded: '1.40'
552
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
553
+
554
+ RSpec/VariableName:
555
+ Description: Checks that memoized helper names use the configured style.
556
+ Enabled: true
557
+ EnforcedStyle: snake_case
558
+ SupportedStyles:
559
+ - snake_case
560
+ - camelCase
561
+ VersionAdded: '1.40'
562
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
563
+
441
564
  RSpec/VerifiedDoubles:
442
565
  Description: Prefer using verifying doubles over normal doubles.
443
566
  Enabled: true
444
567
  IgnoreNameless: true
445
568
  IgnoreSymbolicNames: false
569
+ VersionAdded: 1.2.1
570
+ VersionChanged: '1.5'
446
571
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
447
572
 
448
573
  RSpec/VoidExpect:
449
574
  Description: This cop checks void `expect()`.
450
575
  Enabled: true
576
+ VersionAdded: '1.16'
451
577
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
452
578
 
453
579
  RSpec/Yield:
454
580
  Description: This cop checks for calling a block within a stub.
455
581
  Enabled: true
582
+ VersionAdded: '1.32'
456
583
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
457
584
 
458
585
  Capybara/CurrentPathExpectation:
459
586
  Description: Checks that no expectations are set on Capybara's `current_path`.
460
587
  Enabled: true
588
+ VersionAdded: '1.18'
461
589
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
462
590
 
463
591
  Capybara/FeatureMethods:
464
592
  Description: Checks for consistent method usage in feature specs.
465
593
  Enabled: true
466
594
  EnabledMethods: []
595
+ VersionAdded: '1.17'
596
+ VersionChanged: '1.25'
467
597
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
468
598
 
599
+ Capybara/VisibilityMatcher:
600
+ Description: Checks for boolean visibility in capybara finders.
601
+ Enabled: true
602
+ VersionAdded: '1.39'
603
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
604
+
469
605
  FactoryBot/AttributeDefinedStatically:
470
606
  Description: Always declare attribute values as blocks.
471
607
  Enabled: true
608
+ VersionAdded: '1.28'
472
609
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
473
610
 
474
611
  FactoryBot/CreateList:
@@ -478,11 +615,13 @@ FactoryBot/CreateList:
478
615
  SupportedStyles:
479
616
  - create_list
480
617
  - n_times
618
+ VersionAdded: '1.25'
481
619
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
482
620
 
483
621
  FactoryBot/FactoryClassName:
484
622
  Description: Use string value when setting the class attribute explicitly.
485
623
  Enabled: true
624
+ VersionAdded: '1.37'
486
625
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
487
626
 
488
627
  Rails/HttpStatus:
@@ -492,4 +631,5 @@ Rails/HttpStatus:
492
631
  SupportedStyles:
493
632
  - numeric
494
633
  - symbolic
634
+ VersionAdded: '1.23'
495
635
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus