rubocop-rspec 1.38.0 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/CODE_OF_CONDUCT.md +17 -0
  4. data/README.md +1 -61
  5. data/config/default.yml +147 -17
  6. data/lib/rubocop-rspec.rb +3 -1
  7. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +11 -18
  8. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +11 -18
  9. data/lib/rubocop/cop/rspec/be.rb +1 -1
  10. data/lib/rubocop/cop/rspec/be_eql.rb +5 -5
  11. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +18 -16
  12. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +8 -9
  13. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +69 -0
  14. data/lib/rubocop/cop/rspec/context_method.rb +5 -7
  15. data/lib/rubocop/cop/rspec/cop.rb +9 -29
  16. data/lib/rubocop/cop/rspec/describe_class.rb +20 -5
  17. data/lib/rubocop/cop/rspec/describe_method.rb +0 -1
  18. data/lib/rubocop/cop/rspec/described_class.rb +10 -7
  19. data/lib/rubocop/cop/rspec/dialect.rb +4 -11
  20. data/lib/rubocop/cop/rspec/empty_hook.rb +46 -0
  21. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +5 -3
  22. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +5 -5
  23. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +4 -1
  24. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +5 -5
  25. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +4 -1
  26. data/lib/rubocop/cop/rspec/example_wording.rb +6 -7
  27. data/lib/rubocop/cop/rspec/expect_actual.rb +7 -10
  28. data/lib/rubocop/cop/rspec/expect_change.rb +9 -34
  29. data/lib/rubocop/cop/rspec/expect_in_hook.rb +2 -2
  30. data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
  31. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +23 -20
  32. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +10 -16
  33. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +6 -7
  34. data/lib/rubocop/cop/rspec/file_path.rb +32 -4
  35. data/lib/rubocop/cop/rspec/hook_argument.rb +11 -17
  36. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +9 -28
  37. data/lib/rubocop/cop/rspec/implicit_expect.rb +6 -14
  38. data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -5
  39. data/lib/rubocop/cop/rspec/instance_spy.rb +17 -11
  40. data/lib/rubocop/cop/rspec/instance_variable.rb +3 -7
  41. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +2 -5
  42. data/lib/rubocop/cop/rspec/it_behaves_like.rb +4 -5
  43. data/lib/rubocop/cop/rspec/leading_subject.rb +12 -19
  44. data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -4
  45. data/lib/rubocop/cop/rspec/let_before_examples.rb +9 -25
  46. data/lib/rubocop/cop/rspec/let_setup.rb +15 -3
  47. data/lib/rubocop/cop/rspec/message_chain.rb +6 -5
  48. data/lib/rubocop/cop/rspec/message_expectation.rb +1 -1
  49. data/lib/rubocop/cop/rspec/message_spies.rb +1 -2
  50. data/lib/rubocop/cop/rspec/multiple_subjects.rb +17 -18
  51. data/lib/rubocop/cop/rspec/named_subject.rb +7 -7
  52. data/lib/rubocop/cop/rspec/nested_groups.rb +9 -10
  53. data/lib/rubocop/cop/rspec/not_to_not.rb +4 -5
  54. data/lib/rubocop/cop/rspec/predicate_matcher.rb +25 -55
  55. data/lib/rubocop/cop/rspec/rails/http_status.rb +6 -8
  56. data/lib/rubocop/cop/rspec/receive_counts.rb +14 -16
  57. data/lib/rubocop/cop/rspec/receive_never.rb +10 -10
  58. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +11 -1
  59. data/lib/rubocop/cop/rspec/return_from_stub.rb +11 -21
  60. data/lib/rubocop/cop/rspec/scattered_let.rb +11 -1
  61. data/lib/rubocop/cop/rspec/shared_context.rb +7 -20
  62. data/lib/rubocop/cop/rspec/shared_examples.rb +6 -8
  63. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +14 -17
  64. data/lib/rubocop/cop/rspec/subject_stub.rb +23 -51
  65. data/lib/rubocop/cop/rspec/variable_definition.rb +56 -0
  66. data/lib/rubocop/cop/rspec/variable_name.rb +47 -0
  67. data/lib/rubocop/cop/rspec/yield.rb +13 -10
  68. data/lib/rubocop/cop/rspec_cops.rb +5 -1
  69. data/lib/rubocop/rspec/blank_line_separation.rb +0 -8
  70. data/lib/rubocop/rspec/corrector/move_node.rb +52 -0
  71. data/lib/rubocop/rspec/description_extractor.rb +2 -6
  72. data/lib/rubocop/rspec/example.rb +1 -1
  73. data/lib/rubocop/rspec/example_group.rb +21 -49
  74. data/lib/rubocop/rspec/factory_bot.rb +7 -1
  75. data/lib/rubocop/rspec/language.rb +8 -0
  76. data/lib/rubocop/rspec/language/node_pattern.rb +5 -1
  77. data/lib/rubocop/rspec/top_level_group.rb +44 -0
  78. data/lib/rubocop/rspec/variable.rb +16 -0
  79. data/lib/rubocop/rspec/version.rb +1 -1
  80. metadata +17 -10
  81. data/lib/rubocop/rspec/util.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04629f5b3e67ce4028685a73823dbc4d4ec5b0507162c16c7d1ee2d524871277'
4
- data.tar.gz: 0cd6e7fa477d73f7a0621b9cb80b440f32f96baf109a1eef87166e69efd34df9
3
+ metadata.gz: c377178f53790f52ca57f4e777d0847d69e673e0ca54139e073d7d5f33ef051b
4
+ data.tar.gz: baf53df9cbd5041398fc1f41d028a521f0d05a566a765a6198d1015dd31ae9f3
5
5
  SHA512:
6
- metadata.gz: a0c46cbd0c72758c7e15fde02483a00c8e67c85b2155cddb6b1a0ae77338e0ff12f26e5ba4bf495e828318254f970d374ab3504ab21adda414a0d3663d4f257a
7
- data.tar.gz: 62e31b5d76328e94595256ddd1215d2ae526f5fe4df09ad704a46a3e2865a7eebfc60f64e1b868967315a8b4efd329b4f55e587b646353974c290cd3bd33c474
6
+ metadata.gz: 676ea9472397bc4cd47b7777a1e690f036011ebeedd90c5953b4958ca120bd5178d3a669a8b5392af5945fed792e2c3b50438bb048a50a6e4de86387c31942e7
7
+ data.tar.gz: d4351174b8a17c0af13be4d4417396450e86e6ef5b4a19b3c87d5b6c7fa582e5ee54b3b4172967907d5202b3ca732b4bf2970bc574652fdfffb760cbf23086ea
@@ -2,6 +2,40 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.42.0 (2020-07-09)
6
+
7
+ * Update RuboCop dependency to 0.87.0 because of changes to internal APIs. ([@bquorning][], [@Darhazer][])
8
+
9
+ ## 1.41.0 (2020-07-03)
10
+
11
+ * Extend the list of Rails spec types for `RSpec/DescribeClass`. ([@pirj][])
12
+ * Fix `FactoryBot/AttributeDefinedStatically` to allow `#traits_for_enum` without a block. ([@harrylewis][])
13
+ * Improve the performance of `FactoryBot/AttributeDefinedStatically`, `RSpec/InstanceVariable`, `RSpec/LetSetup`, `RSpec/NestedGroups` and `RSpec/ReturnFromStub`. ([@andrykonchin][])
14
+
15
+ ## 1.40.0 (2020-06-11)
16
+
17
+ * Add new `RSpec/VariableName` cop. ([@tejasbubane][])
18
+ * Add new `RSpec/VariableDefinition` cop. ([@tejasbubane][])
19
+ * Expand `Capybara/VisibilityMatcher` to support more than just `have_selector`. ([@twalpole][])
20
+ * Add new `SpecSuffixOnly` option to `RSpec/FilePath` cop. ([@zdennis][])
21
+ * Allow `RSpec/RepeatedExampleGroupBody` to differ only by described_class. ([@robotdana][])
22
+ * Fix `RSpec/FilePath` detection across sibling directories. ([@rolfschmidt][])
23
+ * Improve the performance of `RSpec/SubjectStub` by an order of magnitude. ([@andrykonchin][])
24
+
25
+ ## 1.39.0 (2020-05-01)
26
+
27
+ * Fix `RSpec/FilePath` detection when absolute path includes test subject. ([@eitoball][])
28
+ * Add new `Capybara/VisibilityMatcher` cop. ([@aried3r][])
29
+ * Ignore String constants by `RSpec/Describe`. ([@AlexWayfer][])
30
+ * Drop support for ruby 2.3. ([@bquorning][])
31
+ * Fix multiple cops to detect `let` with proc argument. ([@tejasbubane][])
32
+ * Add autocorrect support for `RSpec/ScatteredLet`. ([@Darhazer][])
33
+ * Add new `RSpec/EmptyHook` cop. ([@tejasbubane][])
34
+
35
+ ## 1.38.1 (2020-02-15)
36
+
37
+ * Fix `RSpec/RepeatedDescription` to detect descriptions with interpolation and methods. ([@lazycoder9][])
38
+
5
39
  ## 1.38.0 (2020-02-11)
6
40
 
7
41
  * Fix `RSpec/InstanceVariable` detection inside custom matchers. ([@pirj][])
@@ -485,3 +519,13 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
485
519
  [@dduugg]: https://github.com/dduugg
486
520
  [@lazycoder9]: https://github.com/lazycoder9
487
521
  [@elebow]: https://github.com/elebow
522
+ [@eitoball]: https://github.com/eitoball
523
+ [@aried3r]: https://github.com/aried3r
524
+ [@AlexWayfer]: https://github.com/AlexWayfer
525
+ [@tejasbubane]: https://github.com/tejasbubane
526
+ [@twalpole]: https://github.com/twalpole
527
+ [@zdennis]: https://github.com/zdennis
528
+ [@robotdana]: https://github.com/robotdana
529
+ [@rolfschmidt]: https://github.com/rolfschmidt
530
+ [@andrykonchin]: https://github.com/andrykonchin
531
+ [@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
@@ -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,113 +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
477
  RSpec/RepeatedExampleGroupBody:
398
- Enabled: true
399
478
  Description: Check for repeated describe and context block body.
479
+ Enabled: true
480
+ VersionAdded: '1.38'
400
481
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
401
482
 
402
483
  RSpec/RepeatedExampleGroupDescription:
403
- Enabled: true
404
484
  Description: Check for repeated example group descriptions.
485
+ Enabled: true
486
+ VersionAdded: '1.38'
405
487
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
406
488
 
407
489
  RSpec/ReturnFromStub:
408
- Enabled: true
409
490
  Description: Checks for consistent style of stub's return setting.
491
+ Enabled: true
410
492
  EnforcedStyle: and_return
411
493
  SupportedStyles:
412
494
  - and_return
413
495
  - block
496
+ VersionAdded: '1.16'
497
+ VersionChanged: '1.22'
414
498
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
415
499
 
416
500
  RSpec/ScatteredLet:
417
501
  Description: Checks for let scattered across the example group.
418
502
  Enabled: true
503
+ VersionAdded: '1.14'
504
+ VersionChanged: '1.39'
419
505
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
420
506
 
421
507
  RSpec/ScatteredSetup:
422
508
  Description: Checks for setup scattered across multiple hooks in an example group.
423
509
  Enabled: true
510
+ VersionAdded: '1.10'
424
511
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
425
512
 
426
513
  RSpec/SharedContext:
427
514
  Description: Checks for proper shared_context and shared_examples usage.
428
515
  Enabled: true
516
+ VersionAdded: '1.13'
429
517
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
430
518
 
431
519
  RSpec/SharedExamples:
432
520
  Description: Enforces use of string to titleize shared examples.
433
521
  Enabled: true
522
+ VersionAdded: '1.25'
434
523
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
435
524
 
436
525
  RSpec/SingleArgumentMessageChain:
437
526
  Description: Checks that chains of messages contain more than one element.
438
527
  Enabled: true
528
+ VersionAdded: '1.9'
529
+ VersionChanged: '1.10'
439
530
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
440
531
 
441
532
  RSpec/SubjectStub:
442
533
  Description: Checks for stubbed test subjects.
443
534
  Enabled: true
535
+ VersionAdded: '1.7'
444
536
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
445
537
 
446
538
  RSpec/UnspecifiedException:
447
539
  Description: Checks for a specified error in checking raised errors.
448
540
  Enabled: true
541
+ VersionAdded: '1.30'
449
542
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
450
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
+
451
564
  RSpec/VerifiedDoubles:
452
565
  Description: Prefer using verifying doubles over normal doubles.
453
566
  Enabled: true
454
567
  IgnoreNameless: true
455
568
  IgnoreSymbolicNames: false
569
+ VersionAdded: 1.2.1
570
+ VersionChanged: '1.5'
456
571
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
457
572
 
458
573
  RSpec/VoidExpect:
459
574
  Description: This cop checks void `expect()`.
460
575
  Enabled: true
576
+ VersionAdded: '1.16'
461
577
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
462
578
 
463
579
  RSpec/Yield:
464
580
  Description: This cop checks for calling a block within a stub.
465
581
  Enabled: true
582
+ VersionAdded: '1.32'
466
583
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
467
584
 
468
585
  Capybara/CurrentPathExpectation:
469
586
  Description: Checks that no expectations are set on Capybara's `current_path`.
470
587
  Enabled: true
588
+ VersionAdded: '1.18'
471
589
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
472
590
 
473
591
  Capybara/FeatureMethods:
474
592
  Description: Checks for consistent method usage in feature specs.
475
593
  Enabled: true
476
594
  EnabledMethods: []
595
+ VersionAdded: '1.17'
596
+ VersionChanged: '1.25'
477
597
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
478
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
+
479
605
  FactoryBot/AttributeDefinedStatically:
480
606
  Description: Always declare attribute values as blocks.
481
607
  Enabled: true
608
+ VersionAdded: '1.28'
482
609
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
483
610
 
484
611
  FactoryBot/CreateList:
@@ -488,11 +615,13 @@ FactoryBot/CreateList:
488
615
  SupportedStyles:
489
616
  - create_list
490
617
  - n_times
618
+ VersionAdded: '1.25'
491
619
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
492
620
 
493
621
  FactoryBot/FactoryClassName:
494
622
  Description: Use string value when setting the class attribute explicitly.
495
623
  Enabled: true
624
+ VersionAdded: '1.37'
496
625
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
497
626
 
498
627
  Rails/HttpStatus:
@@ -502,4 +631,5 @@ Rails/HttpStatus:
502
631
  SupportedStyles:
503
632
  - numeric
504
633
  - symbolic
634
+ VersionAdded: '1.23'
505
635
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus