standard-rspec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +56 -0
- data/config/base.yml +847 -0
- data/lib/standard/rspec/load_rubocop_rspec_without_the_monkey_patch.rb +77 -0
- data/lib/standard/rspec/plugin.rb +64 -0
- data/lib/standard/rspec/version.rb +7 -0
- data/lib/standard/rspec.rb +4 -0
- data/lib/standard-rspec.rb +1 -0
- data/sig/standard/rspec.rbs +1 -0
- data/standard-rspec.gemspec +36 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a52f43573a77eb3e913884f86127b843e24f0a1329567e5b979b71e4b9bfdbbe
|
4
|
+
data.tar.gz: 2a7688b36e1d494ab25994214537acf2464d27ca79eef060438002facbeda054
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d393923db44ff1282727519024c69077e771aa5fc0b2ddd4f5641fe7a458c9476d7976c6a50fef57ebef843d051ec974ab9a07d3774305f76f1d3061d35ced72
|
7
|
+
data.tar.gz: d6e88c191aa9e2211950b89ccd66bbd65ce3a5acf92d333ff6959ff0c5ba39d3122de7ca7365e917a9e09676c22f3d95fa0c3fca95f34f89054987d3612829b7
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 shilin-anton
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Standard::Rspec
|
2
|
+
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
4
|
+
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/standard/rspec`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
+
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
12
|
+
|
13
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
+
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
+
|
17
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
+
|
27
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/shilin-anton/standard-rspec.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubocop-rspec"
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.libs << "lib"
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
task :copy_rubocop_rspec_entry_point_and_comment_out_monkey_patch do
|
14
|
+
gem_spec = Gem.loaded_specs["rubocop-rspec"]
|
15
|
+
gem_require_path = Pathname.new(gem_spec.full_require_paths.first)
|
16
|
+
entry_point_contents = File.read(gem_require_path.join("rubocop-rspec.rb"))
|
17
|
+
already_printed_load_path_veriable = false
|
18
|
+
entry_point_without_monkey_patch = entry_point_contents.split("\n").map { |line|
|
19
|
+
if line.include?("Inject.defaults!") || line.include?("rspec/inject")
|
20
|
+
line.prepend("# ")
|
21
|
+
elsif line.include?("require_relative")
|
22
|
+
relative_path = line.match(/require_relative ['"](.*)['"]/)[1]
|
23
|
+
|
24
|
+
if !already_printed_load_path_veriable
|
25
|
+
already_printed_load_path_veriable = true
|
26
|
+
[
|
27
|
+
"require_path = Pathname.new(Gem.loaded_specs[\"rubocop-rspec\"].full_require_paths.first)",
|
28
|
+
"require require_path.join(#{relative_path.inspect})"
|
29
|
+
]
|
30
|
+
else
|
31
|
+
"require require_path.join(#{relative_path.inspect})"
|
32
|
+
end
|
33
|
+
else
|
34
|
+
line
|
35
|
+
end
|
36
|
+
}.flatten.join("\n")
|
37
|
+
|
38
|
+
File.write "lib/standard/rspec/load_rubocop_rspec_without_the_monkey_patch.rb", <<~RUBY
|
39
|
+
# GENERATED FILE - DO NOT EDIT
|
40
|
+
#
|
41
|
+
# This file should look just like: https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop-rspec.rb
|
42
|
+
# Except without the `Inject.defaults!` monkey patching.
|
43
|
+
#
|
44
|
+
# Because there are both necessary require statements and additional patching
|
45
|
+
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
46
|
+
# in rubocop-rails and keep it up to date.
|
47
|
+
#
|
48
|
+
# Last updated from #{gem_spec.name} v#{gem_spec.version}
|
49
|
+
|
50
|
+
#{entry_point_without_monkey_patch}
|
51
|
+
RUBY
|
52
|
+
end
|
53
|
+
|
54
|
+
require "standard/rake"
|
55
|
+
|
56
|
+
task default: %i[copy_rubocop_rspec_entry_point_and_comment_out_monkey_patch standard:fix test]
|
data/config/base.yml
ADDED
@@ -0,0 +1,847 @@
|
|
1
|
+
---
|
2
|
+
RSpec:
|
3
|
+
Enabled: true
|
4
|
+
Include: &1
|
5
|
+
- "**/*_spec.rb"
|
6
|
+
- "**/spec/**/*"
|
7
|
+
Language: &2
|
8
|
+
inherit_mode:
|
9
|
+
merge:
|
10
|
+
- Expectations
|
11
|
+
- Helpers
|
12
|
+
- Hooks
|
13
|
+
- HookScopes
|
14
|
+
- Runners
|
15
|
+
- Subjects
|
16
|
+
ExampleGroups:
|
17
|
+
inherit_mode:
|
18
|
+
merge:
|
19
|
+
- Regular
|
20
|
+
- Skipped
|
21
|
+
- Focused
|
22
|
+
Regular:
|
23
|
+
- describe
|
24
|
+
- context
|
25
|
+
- feature
|
26
|
+
- example_group
|
27
|
+
Skipped:
|
28
|
+
- xdescribe
|
29
|
+
- xcontext
|
30
|
+
- xfeature
|
31
|
+
Focused:
|
32
|
+
- fdescribe
|
33
|
+
- fcontext
|
34
|
+
- ffeature
|
35
|
+
Examples:
|
36
|
+
inherit_mode:
|
37
|
+
merge:
|
38
|
+
- Regular
|
39
|
+
- Skipped
|
40
|
+
- Focused
|
41
|
+
- Pending
|
42
|
+
Regular:
|
43
|
+
- it
|
44
|
+
- specify
|
45
|
+
- example
|
46
|
+
- scenario
|
47
|
+
- its
|
48
|
+
Focused:
|
49
|
+
- fit
|
50
|
+
- fspecify
|
51
|
+
- fexample
|
52
|
+
- fscenario
|
53
|
+
- focus
|
54
|
+
Skipped:
|
55
|
+
- xit
|
56
|
+
- xspecify
|
57
|
+
- xexample
|
58
|
+
- xscenario
|
59
|
+
- skip
|
60
|
+
Pending:
|
61
|
+
- pending
|
62
|
+
Expectations:
|
63
|
+
- expect
|
64
|
+
- is_expected
|
65
|
+
- expect_any_instance_of
|
66
|
+
Helpers:
|
67
|
+
- let
|
68
|
+
- let!
|
69
|
+
Hooks:
|
70
|
+
- prepend_before
|
71
|
+
- before
|
72
|
+
- append_before
|
73
|
+
- around
|
74
|
+
- prepend_after
|
75
|
+
- after
|
76
|
+
- append_after
|
77
|
+
HookScopes:
|
78
|
+
- each
|
79
|
+
- example
|
80
|
+
- context
|
81
|
+
- all
|
82
|
+
- suite
|
83
|
+
Includes:
|
84
|
+
inherit_mode:
|
85
|
+
merge:
|
86
|
+
- Examples
|
87
|
+
- Context
|
88
|
+
Examples:
|
89
|
+
- it_behaves_like
|
90
|
+
- it_should_behave_like
|
91
|
+
- include_examples
|
92
|
+
Context:
|
93
|
+
- include_context
|
94
|
+
Runners:
|
95
|
+
- to
|
96
|
+
- to_not
|
97
|
+
- not_to
|
98
|
+
SharedGroups:
|
99
|
+
inherit_mode:
|
100
|
+
merge:
|
101
|
+
- Examples
|
102
|
+
- Context
|
103
|
+
Examples:
|
104
|
+
- shared_examples
|
105
|
+
- shared_examples_for
|
106
|
+
Context:
|
107
|
+
- shared_context
|
108
|
+
Subjects:
|
109
|
+
- subject
|
110
|
+
- subject!
|
111
|
+
|
112
|
+
RSpec/AlignLeftLetBrace:
|
113
|
+
Description: Checks that left braces for adjacent single line lets are aligned.
|
114
|
+
Enabled: false
|
115
|
+
VersionAdded: '1.16'
|
116
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
117
|
+
|
118
|
+
RSpec/AlignRightLetBrace:
|
119
|
+
Description: Checks that right braces for adjacent single line lets are aligned.
|
120
|
+
Enabled: false
|
121
|
+
VersionAdded: '1.16'
|
122
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
123
|
+
|
124
|
+
RSpec/AnyInstance:
|
125
|
+
Description: Check that instances are not being stubbed globally.
|
126
|
+
Enabled: true
|
127
|
+
VersionAdded: '1.4'
|
128
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
129
|
+
|
130
|
+
RSpec/AroundBlock:
|
131
|
+
Description: Checks that around blocks actually run the test.
|
132
|
+
Enabled: true
|
133
|
+
VersionAdded: '1.11'
|
134
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
135
|
+
|
136
|
+
RSpec/Be:
|
137
|
+
Description: Check for expectations where `be` is used without argument.
|
138
|
+
Enabled: true
|
139
|
+
VersionAdded: '1.25'
|
140
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
141
|
+
|
142
|
+
RSpec/BeEql:
|
143
|
+
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
144
|
+
Enabled: true
|
145
|
+
VersionAdded: '1.7'
|
146
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
147
|
+
|
148
|
+
RSpec/BeforeAfterAll:
|
149
|
+
Description: Check that before/after(:all) isn't being used.
|
150
|
+
Enabled: true
|
151
|
+
Exclude:
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- spec/rails_helper.rb
|
154
|
+
- spec/support/**/*.rb
|
155
|
+
VersionAdded: '1.12'
|
156
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
157
|
+
|
158
|
+
RSpec/ContextMethod:
|
159
|
+
Description: "`context` should not be used for specifying methods."
|
160
|
+
Enabled: true
|
161
|
+
VersionAdded: '1.36'
|
162
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
163
|
+
|
164
|
+
RSpec/ContextWording:
|
165
|
+
Description: Checks that `context` docstring starts with an allowed prefix.
|
166
|
+
Enabled: true
|
167
|
+
Prefixes:
|
168
|
+
- when
|
169
|
+
- with
|
170
|
+
- without
|
171
|
+
VersionAdded: '1.20'
|
172
|
+
VersionChanged: 1.20.1
|
173
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
174
|
+
|
175
|
+
RSpec/DescribeClass:
|
176
|
+
Description: Check that the first argument to the top-level describe is a constant.
|
177
|
+
Enabled: true
|
178
|
+
Exclude:
|
179
|
+
- "**/spec/features/**/*"
|
180
|
+
- "**/spec/requests/**/*"
|
181
|
+
- "**/spec/routing/**/*"
|
182
|
+
- "**/spec/system/**/*"
|
183
|
+
- "**/spec/views/**/*"
|
184
|
+
IgnoredMetadata:
|
185
|
+
type:
|
186
|
+
- channel
|
187
|
+
- controller
|
188
|
+
- helper
|
189
|
+
- job
|
190
|
+
- mailer
|
191
|
+
- model
|
192
|
+
- request
|
193
|
+
- routing
|
194
|
+
- view
|
195
|
+
- feature
|
196
|
+
- system
|
197
|
+
- mailbox
|
198
|
+
- aruba
|
199
|
+
- task
|
200
|
+
VersionAdded: '1.0'
|
201
|
+
VersionChanged: '2.7'
|
202
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
203
|
+
|
204
|
+
RSpec/DescribeMethod:
|
205
|
+
Description: Checks that the second argument to `describe` specifies a method.
|
206
|
+
Enabled: true
|
207
|
+
VersionAdded: '1.0'
|
208
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
209
|
+
|
210
|
+
RSpec/DescribeSymbol:
|
211
|
+
Description: Avoid describing symbols.
|
212
|
+
Enabled: true
|
213
|
+
VersionAdded: '1.15'
|
214
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
215
|
+
|
216
|
+
RSpec/DescribedClass:
|
217
|
+
Description: Checks that tests use `described_class`.
|
218
|
+
Enabled: true
|
219
|
+
SkipBlocks: false
|
220
|
+
EnforcedStyle: described_class
|
221
|
+
SupportedStyles:
|
222
|
+
- described_class
|
223
|
+
- explicit
|
224
|
+
SafeAutoCorrect: false
|
225
|
+
VersionAdded: '1.0'
|
226
|
+
VersionChanged: '1.11'
|
227
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
228
|
+
|
229
|
+
RSpec/DescribedClassModuleWrapping:
|
230
|
+
Description: Avoid opening modules and defining specs within them.
|
231
|
+
Enabled: false
|
232
|
+
VersionAdded: '1.37'
|
233
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
234
|
+
|
235
|
+
RSpec/Dialect:
|
236
|
+
Description: This cop enforces custom RSpec dialects.
|
237
|
+
Enabled: false
|
238
|
+
PreferredMethods: {}
|
239
|
+
VersionAdded: '1.33'
|
240
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
241
|
+
|
242
|
+
RSpec/EmptyExampleGroup:
|
243
|
+
Description: Checks if an example group does not include any tests.
|
244
|
+
Enabled: true
|
245
|
+
VersionAdded: '1.7'
|
246
|
+
VersionChanged: '2.0'
|
247
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
248
|
+
|
249
|
+
RSpec/EmptyHook:
|
250
|
+
Description: Checks for empty before and after hooks.
|
251
|
+
Enabled: true
|
252
|
+
VersionAdded: '1.39'
|
253
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
254
|
+
|
255
|
+
RSpec/EmptyLineAfterExample:
|
256
|
+
Description: Checks if there is an empty line after example blocks.
|
257
|
+
Enabled: true
|
258
|
+
AllowConsecutiveOneLiners: true
|
259
|
+
VersionAdded: '1.36'
|
260
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
261
|
+
|
262
|
+
RSpec/EmptyLineAfterExampleGroup:
|
263
|
+
Description: Checks if there is an empty line after example group blocks.
|
264
|
+
Enabled: true
|
265
|
+
VersionAdded: '1.27'
|
266
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
267
|
+
|
268
|
+
RSpec/EmptyLineAfterFinalLet:
|
269
|
+
Description: Checks if there is an empty line after the last let block.
|
270
|
+
Enabled: true
|
271
|
+
VersionAdded: '1.14'
|
272
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
273
|
+
|
274
|
+
RSpec/EmptyLineAfterHook:
|
275
|
+
Description: Checks if there is an empty line after hook blocks.
|
276
|
+
Enabled: true
|
277
|
+
VersionAdded: '1.27'
|
278
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
279
|
+
|
280
|
+
RSpec/EmptyLineAfterSubject:
|
281
|
+
Description: Checks if there is an empty line after subject block.
|
282
|
+
Enabled: true
|
283
|
+
VersionAdded: '1.14'
|
284
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
285
|
+
|
286
|
+
RSpec/ExampleLength:
|
287
|
+
Description: Checks for long examples.
|
288
|
+
Enabled: true
|
289
|
+
Max: 5
|
290
|
+
CountAsOne: []
|
291
|
+
VersionAdded: '1.5'
|
292
|
+
VersionChanged: '2.3'
|
293
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
294
|
+
|
295
|
+
RSpec/ExampleWithoutDescription:
|
296
|
+
Description: Checks for examples without a description.
|
297
|
+
Enabled: true
|
298
|
+
EnforcedStyle: always_allow
|
299
|
+
SupportedStyles:
|
300
|
+
- always_allow
|
301
|
+
- single_line_only
|
302
|
+
- disallow
|
303
|
+
VersionAdded: '1.22'
|
304
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
305
|
+
|
306
|
+
RSpec/ExcessiveDocstringSpacing:
|
307
|
+
Description: Checks for excessive whitespace in example descriptions.
|
308
|
+
Enabled: pending
|
309
|
+
VersionAdded: '2.5'
|
310
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
311
|
+
|
312
|
+
RSpec/ExampleWording:
|
313
|
+
Description: Checks for common mistakes in example descriptions.
|
314
|
+
Enabled: true
|
315
|
+
CustomTransform:
|
316
|
+
be: is
|
317
|
+
BE: IS
|
318
|
+
have: has
|
319
|
+
HAVE: HAS
|
320
|
+
IgnoredWords: []
|
321
|
+
VersionAdded: '1.0'
|
322
|
+
VersionChanged: '1.2'
|
323
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
324
|
+
|
325
|
+
RSpec/ExpectActual:
|
326
|
+
Description: Checks for `expect(...)` calls containing literal values.
|
327
|
+
Enabled: true
|
328
|
+
Exclude:
|
329
|
+
- spec/routing/**/*
|
330
|
+
VersionAdded: '1.7'
|
331
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
332
|
+
|
333
|
+
RSpec/ExpectChange:
|
334
|
+
Description: Checks for consistent style of change matcher.
|
335
|
+
Enabled: true
|
336
|
+
EnforcedStyle: method_call
|
337
|
+
SupportedStyles:
|
338
|
+
- method_call
|
339
|
+
- block
|
340
|
+
SafeAutoCorrect: false
|
341
|
+
VersionAdded: '1.22'
|
342
|
+
VersionChanged: '2.5'
|
343
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
344
|
+
|
345
|
+
RSpec/ExpectInHook:
|
346
|
+
Description: Do not use `expect` in hooks such as `before`.
|
347
|
+
Enabled: true
|
348
|
+
VersionAdded: '1.16'
|
349
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
350
|
+
|
351
|
+
RSpec/ExpectOutput:
|
352
|
+
Description: Checks for opportunities to use `expect { ... }.to output`.
|
353
|
+
Enabled: true
|
354
|
+
VersionAdded: '1.10'
|
355
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
356
|
+
|
357
|
+
RSpec/FilePath:
|
358
|
+
Description: Checks that spec file paths are consistent and well-formed.
|
359
|
+
Enabled: true
|
360
|
+
Include:
|
361
|
+
- "**/*_spec*rb*"
|
362
|
+
- "**/spec/**/*"
|
363
|
+
CustomTransform:
|
364
|
+
RuboCop: rubocop
|
365
|
+
RSpec: rspec
|
366
|
+
IgnoreMethods: false
|
367
|
+
SpecSuffixOnly: false
|
368
|
+
VersionAdded: '1.2'
|
369
|
+
VersionChanged: '1.40'
|
370
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
371
|
+
|
372
|
+
RSpec/Focus:
|
373
|
+
Description: Checks if examples are focused.
|
374
|
+
Enabled: true
|
375
|
+
VersionAdded: '1.5'
|
376
|
+
VersionChanged: '2.1'
|
377
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
378
|
+
|
379
|
+
RSpec/HookArgument:
|
380
|
+
Description: Checks the arguments passed to `before`, `around`, and `after`.
|
381
|
+
Enabled: true
|
382
|
+
EnforcedStyle: implicit
|
383
|
+
SupportedStyles:
|
384
|
+
- implicit
|
385
|
+
- each
|
386
|
+
- example
|
387
|
+
VersionAdded: '1.7'
|
388
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
389
|
+
|
390
|
+
RSpec/HooksBeforeExamples:
|
391
|
+
Description: Checks for before/around/after hooks that come after an example.
|
392
|
+
Enabled: true
|
393
|
+
VersionAdded: '1.29'
|
394
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
395
|
+
|
396
|
+
RSpec/IdenticalEqualityAssertion:
|
397
|
+
Description: Checks for equality assertions with identical expressions on both sides.
|
398
|
+
Enabled: pending
|
399
|
+
VersionAdded: '2.4'
|
400
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
|
401
|
+
|
402
|
+
RSpec/ImplicitBlockExpectation:
|
403
|
+
Description: Check that implicit block expectation syntax is not used.
|
404
|
+
Enabled: true
|
405
|
+
VersionAdded: '1.35'
|
406
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
407
|
+
|
408
|
+
RSpec/ImplicitExpect:
|
409
|
+
Description: Check that a consistent implicit expectation style is used.
|
410
|
+
Enabled: true
|
411
|
+
EnforcedStyle: is_expected
|
412
|
+
SupportedStyles:
|
413
|
+
- is_expected
|
414
|
+
- should
|
415
|
+
VersionAdded: '1.8'
|
416
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
417
|
+
|
418
|
+
RSpec/ImplicitSubject:
|
419
|
+
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
420
|
+
Enabled: true
|
421
|
+
EnforcedStyle: single_line_only
|
422
|
+
SupportedStyles:
|
423
|
+
- single_line_only
|
424
|
+
- single_statement_only
|
425
|
+
- disallow
|
426
|
+
VersionAdded: '1.29'
|
427
|
+
VersionChanged: '1.30'
|
428
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
429
|
+
|
430
|
+
RSpec/InstanceSpy:
|
431
|
+
Description: Checks for `instance_double` used with `have_received`.
|
432
|
+
Enabled: true
|
433
|
+
VersionAdded: '1.12'
|
434
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
435
|
+
|
436
|
+
RSpec/InstanceVariable:
|
437
|
+
Description: Checks for instance variable usage in specs.
|
438
|
+
Enabled: true
|
439
|
+
AssignmentOnly: false
|
440
|
+
VersionAdded: '1.0'
|
441
|
+
VersionChanged: '1.7'
|
442
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
443
|
+
|
444
|
+
RSpec/ItBehavesLike:
|
445
|
+
Description: Checks that only one `it_behaves_like` style is used.
|
446
|
+
Enabled: true
|
447
|
+
EnforcedStyle: it_behaves_like
|
448
|
+
SupportedStyles:
|
449
|
+
- it_behaves_like
|
450
|
+
- it_should_behave_like
|
451
|
+
VersionAdded: '1.13'
|
452
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
453
|
+
|
454
|
+
RSpec/IteratedExpectation:
|
455
|
+
Description: Check that `all` matcher is used instead of iterating over an array.
|
456
|
+
Enabled: true
|
457
|
+
VersionAdded: '1.14'
|
458
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
459
|
+
|
460
|
+
RSpec/LeadingSubject:
|
461
|
+
Description: Enforce that subject is the first definition in the test.
|
462
|
+
Enabled: true
|
463
|
+
VersionAdded: '1.7'
|
464
|
+
VersionChanged: '1.14'
|
465
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
466
|
+
|
467
|
+
RSpec/LeakyConstantDeclaration:
|
468
|
+
Description: Checks that no class, module, or constant is declared.
|
469
|
+
Enabled: true
|
470
|
+
VersionAdded: '1.35'
|
471
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
472
|
+
|
473
|
+
RSpec/LetBeforeExamples:
|
474
|
+
Description: Checks for `let` definitions that come after an example.
|
475
|
+
Enabled: true
|
476
|
+
VersionAdded: '1.16'
|
477
|
+
VersionChanged: '1.22'
|
478
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
479
|
+
|
480
|
+
RSpec/LetSetup:
|
481
|
+
Description: Checks unreferenced `let!` calls being used for test setup.
|
482
|
+
Enabled: true
|
483
|
+
VersionAdded: '1.7'
|
484
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
485
|
+
|
486
|
+
RSpec/MessageChain:
|
487
|
+
Description: Check that chains of messages are not being stubbed.
|
488
|
+
Enabled: true
|
489
|
+
VersionAdded: '1.7'
|
490
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
491
|
+
|
492
|
+
RSpec/MessageExpectation:
|
493
|
+
Description: Checks for consistent message expectation style.
|
494
|
+
Enabled: false
|
495
|
+
EnforcedStyle: allow
|
496
|
+
SupportedStyles:
|
497
|
+
- allow
|
498
|
+
- expect
|
499
|
+
VersionAdded: '1.7'
|
500
|
+
VersionChanged: '1.8'
|
501
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
502
|
+
|
503
|
+
RSpec/MessageSpies:
|
504
|
+
Description: Checks that message expectations are set using spies.
|
505
|
+
Enabled: true
|
506
|
+
EnforcedStyle: have_received
|
507
|
+
SupportedStyles:
|
508
|
+
- have_received
|
509
|
+
- receive
|
510
|
+
VersionAdded: '1.9'
|
511
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
512
|
+
|
513
|
+
RSpec/MissingExampleGroupArgument:
|
514
|
+
Description: Checks that the first argument to an example group is not empty.
|
515
|
+
Enabled: true
|
516
|
+
VersionAdded: '1.28'
|
517
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
518
|
+
|
519
|
+
RSpec/MultipleDescribes:
|
520
|
+
Description: Checks for multiple top-level example groups.
|
521
|
+
Enabled: true
|
522
|
+
VersionAdded: '1.0'
|
523
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
524
|
+
|
525
|
+
RSpec/MultipleExpectations:
|
526
|
+
Description: Checks if examples contain too many `expect` calls.
|
527
|
+
Enabled: true
|
528
|
+
Max: 1
|
529
|
+
VersionAdded: '1.7'
|
530
|
+
VersionChanged: '1.21'
|
531
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
532
|
+
|
533
|
+
RSpec/MultipleMemoizedHelpers:
|
534
|
+
Description: Checks if example groups contain too many `let` and `subject` calls.
|
535
|
+
Enabled: true
|
536
|
+
AllowSubject: true
|
537
|
+
Max: 5
|
538
|
+
VersionAdded: '1.43'
|
539
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
|
540
|
+
|
541
|
+
RSpec/MultipleSubjects:
|
542
|
+
Description: Checks if an example group defines `subject` multiple times.
|
543
|
+
Enabled: true
|
544
|
+
VersionAdded: '1.16'
|
545
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
546
|
+
|
547
|
+
RSpec/NamedSubject:
|
548
|
+
Description: Checks for explicitly referenced test subjects.
|
549
|
+
Enabled: true
|
550
|
+
IgnoreSharedExamples: true
|
551
|
+
VersionAdded: 1.5.3
|
552
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
553
|
+
|
554
|
+
RSpec/NestedGroups:
|
555
|
+
Description: Checks for nested example groups.
|
556
|
+
Enabled: true
|
557
|
+
Max: 3
|
558
|
+
VersionAdded: '1.7'
|
559
|
+
VersionChanged: '1.10'
|
560
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
561
|
+
|
562
|
+
RSpec/NotToNot:
|
563
|
+
Description: Checks for consistent method usage for negating expectations.
|
564
|
+
Enabled: true
|
565
|
+
EnforcedStyle: not_to
|
566
|
+
SupportedStyles:
|
567
|
+
- not_to
|
568
|
+
- to_not
|
569
|
+
VersionAdded: '1.4'
|
570
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
571
|
+
|
572
|
+
RSpec/OverwritingSetup:
|
573
|
+
Description: Checks if there is a let/subject that overwrites an existing one.
|
574
|
+
Enabled: true
|
575
|
+
VersionAdded: '1.14'
|
576
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
577
|
+
|
578
|
+
RSpec/Pending:
|
579
|
+
Description: Checks for any pending or skipped examples.
|
580
|
+
Enabled: false
|
581
|
+
VersionAdded: '1.25'
|
582
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
583
|
+
|
584
|
+
RSpec/PredicateMatcher:
|
585
|
+
Description: Prefer using predicate matcher over using predicate method directly.
|
586
|
+
Enabled: true
|
587
|
+
Strict: true
|
588
|
+
EnforcedStyle: inflected
|
589
|
+
AllowedExplicitMatchers: []
|
590
|
+
SupportedStyles:
|
591
|
+
- inflected
|
592
|
+
- explicit
|
593
|
+
SafeAutoCorrect: false
|
594
|
+
VersionAdded: '1.16'
|
595
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
596
|
+
|
597
|
+
RSpec/ReceiveCounts:
|
598
|
+
Description: Check for `once` and `twice` receive counts matchers usage.
|
599
|
+
Enabled: true
|
600
|
+
VersionAdded: '1.26'
|
601
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
602
|
+
|
603
|
+
RSpec/ReceiveNever:
|
604
|
+
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
605
|
+
Enabled: true
|
606
|
+
VersionAdded: '1.28'
|
607
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
608
|
+
|
609
|
+
RSpec/RepeatedDescription:
|
610
|
+
Description: Check for repeated description strings in example groups.
|
611
|
+
Enabled: true
|
612
|
+
VersionAdded: '1.9'
|
613
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
614
|
+
|
615
|
+
RSpec/RepeatedExample:
|
616
|
+
Description: Check for repeated examples within example groups.
|
617
|
+
Enabled: true
|
618
|
+
VersionAdded: '1.10'
|
619
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
620
|
+
|
621
|
+
RSpec/RepeatedExampleGroupBody:
|
622
|
+
Description: Check for repeated describe and context block body.
|
623
|
+
Enabled: true
|
624
|
+
VersionAdded: '1.38'
|
625
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
626
|
+
|
627
|
+
RSpec/RepeatedExampleGroupDescription:
|
628
|
+
Description: Check for repeated example group descriptions.
|
629
|
+
Enabled: true
|
630
|
+
VersionAdded: '1.38'
|
631
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
632
|
+
|
633
|
+
RSpec/RepeatedIncludeExample:
|
634
|
+
Description: Check for repeated include of shared examples.
|
635
|
+
Enabled: true
|
636
|
+
VersionAdded: '1.44'
|
637
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
|
638
|
+
|
639
|
+
RSpec/ReturnFromStub:
|
640
|
+
Description: Checks for consistent style of stub's return setting.
|
641
|
+
Enabled: true
|
642
|
+
EnforcedStyle: and_return
|
643
|
+
SupportedStyles:
|
644
|
+
- and_return
|
645
|
+
- block
|
646
|
+
VersionAdded: '1.16'
|
647
|
+
VersionChanged: '1.22'
|
648
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
649
|
+
|
650
|
+
RSpec/ScatteredLet:
|
651
|
+
Description: Checks for let scattered across the example group.
|
652
|
+
Enabled: true
|
653
|
+
VersionAdded: '1.14'
|
654
|
+
VersionChanged: '1.39'
|
655
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
656
|
+
|
657
|
+
RSpec/ScatteredSetup:
|
658
|
+
Description: Checks for setup scattered across multiple hooks in an example group.
|
659
|
+
Enabled: true
|
660
|
+
VersionAdded: '1.10'
|
661
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
662
|
+
|
663
|
+
RSpec/SharedContext:
|
664
|
+
Description: Checks for proper shared_context and shared_examples usage.
|
665
|
+
Enabled: true
|
666
|
+
VersionAdded: '1.13'
|
667
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
668
|
+
|
669
|
+
RSpec/SharedExamples:
|
670
|
+
Description: Enforces use of string to titleize shared examples.
|
671
|
+
Enabled: true
|
672
|
+
VersionAdded: '1.25'
|
673
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
674
|
+
|
675
|
+
RSpec/SingleArgumentMessageChain:
|
676
|
+
Description: Checks that chains of messages contain more than one element.
|
677
|
+
Enabled: true
|
678
|
+
VersionAdded: '1.9'
|
679
|
+
VersionChanged: '1.10'
|
680
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
681
|
+
|
682
|
+
RSpec/StubbedMock:
|
683
|
+
Description: Checks that message expectations do not have a configured response.
|
684
|
+
Enabled: true
|
685
|
+
VersionAdded: '1.44'
|
686
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
687
|
+
|
688
|
+
RSpec/SubjectDeclaration:
|
689
|
+
Description: Ensure that subject is defined using subject helper.
|
690
|
+
Enabled: pending
|
691
|
+
VersionAdded: '2.5'
|
692
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration
|
693
|
+
|
694
|
+
RSpec/SubjectStub:
|
695
|
+
Description: Checks for stubbed test subjects.
|
696
|
+
Enabled: true
|
697
|
+
VersionAdded: '1.7'
|
698
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
699
|
+
|
700
|
+
RSpec/UnspecifiedException:
|
701
|
+
Description: Checks for a specified error in checking raised errors.
|
702
|
+
Enabled: true
|
703
|
+
VersionAdded: '1.30'
|
704
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
705
|
+
|
706
|
+
RSpec/VariableDefinition:
|
707
|
+
Description: Checks that memoized helpers names are symbols or strings.
|
708
|
+
Enabled: true
|
709
|
+
EnforcedStyle: symbols
|
710
|
+
SupportedStyles:
|
711
|
+
- symbols
|
712
|
+
- strings
|
713
|
+
VersionAdded: '1.40'
|
714
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
715
|
+
|
716
|
+
RSpec/VariableName:
|
717
|
+
Description: Checks that memoized helper names use the configured style.
|
718
|
+
Enabled: true
|
719
|
+
EnforcedStyle: snake_case
|
720
|
+
SupportedStyles:
|
721
|
+
- snake_case
|
722
|
+
- camelCase
|
723
|
+
IgnoredPatterns: []
|
724
|
+
VersionAdded: '1.40'
|
725
|
+
VersionChanged: '1.43'
|
726
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
727
|
+
|
728
|
+
RSpec/VerifiedDoubles:
|
729
|
+
Description: Prefer using verifying doubles over normal doubles.
|
730
|
+
Enabled: true
|
731
|
+
IgnoreNameless: true
|
732
|
+
IgnoreSymbolicNames: false
|
733
|
+
VersionAdded: 1.2.1
|
734
|
+
VersionChanged: '1.5'
|
735
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
736
|
+
|
737
|
+
RSpec/VoidExpect:
|
738
|
+
Description: This cop checks void `expect()`.
|
739
|
+
Enabled: true
|
740
|
+
VersionAdded: '1.16'
|
741
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
742
|
+
|
743
|
+
RSpec/Yield:
|
744
|
+
Description: This cop checks for calling a block within a stub.
|
745
|
+
Enabled: true
|
746
|
+
VersionAdded: '1.32'
|
747
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
748
|
+
|
749
|
+
RSpec/Capybara:
|
750
|
+
Enabled: true
|
751
|
+
Include: *1
|
752
|
+
Language: *2
|
753
|
+
|
754
|
+
RSpec/Capybara/CurrentPathExpectation:
|
755
|
+
Description: Checks that no expectations are set on Capybara's `current_path`.
|
756
|
+
Enabled: true
|
757
|
+
VersionAdded: '1.18'
|
758
|
+
VersionChanged: '2.0'
|
759
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
760
|
+
|
761
|
+
RSpec/Capybara/FeatureMethods:
|
762
|
+
Description: Checks for consistent method usage in feature specs.
|
763
|
+
Enabled: true
|
764
|
+
EnabledMethods: []
|
765
|
+
VersionAdded: '1.17'
|
766
|
+
VersionChanged: '2.0'
|
767
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
768
|
+
|
769
|
+
RSpec/Capybara/VisibilityMatcher:
|
770
|
+
Description: Checks for boolean visibility in capybara finders.
|
771
|
+
Enabled: true
|
772
|
+
VersionAdded: '1.39'
|
773
|
+
VersionChanged: '2.0'
|
774
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
|
775
|
+
|
776
|
+
RSpec/FactoryBot:
|
777
|
+
Enabled: true
|
778
|
+
Include: *1
|
779
|
+
Language: *2
|
780
|
+
|
781
|
+
RSpec/FactoryBot/AttributeDefinedStatically:
|
782
|
+
Description: Always declare attribute values as blocks.
|
783
|
+
Enabled: true
|
784
|
+
Include:
|
785
|
+
- spec/factories.rb
|
786
|
+
- spec/factories/**/*.rb
|
787
|
+
- features/support/factories/**/*.rb
|
788
|
+
VersionAdded: '1.28'
|
789
|
+
VersionChanged: '2.0'
|
790
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
791
|
+
|
792
|
+
RSpec/FactoryBot/CreateList:
|
793
|
+
Description: Checks for create_list usage.
|
794
|
+
Enabled: true
|
795
|
+
Include:
|
796
|
+
- "**/*_spec.rb"
|
797
|
+
- "**/spec/**/*"
|
798
|
+
- spec/factories.rb
|
799
|
+
- spec/factories/**/*.rb
|
800
|
+
- features/support/factories/**/*.rb
|
801
|
+
EnforcedStyle: create_list
|
802
|
+
SupportedStyles:
|
803
|
+
- create_list
|
804
|
+
- n_times
|
805
|
+
VersionAdded: '1.25'
|
806
|
+
VersionChanged: '2.0'
|
807
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
808
|
+
|
809
|
+
RSpec/FactoryBot/FactoryClassName:
|
810
|
+
Description: Use string value when setting the class attribute explicitly.
|
811
|
+
Enabled: true
|
812
|
+
Include:
|
813
|
+
- spec/factories.rb
|
814
|
+
- spec/factories/**/*.rb
|
815
|
+
- features/support/factories/**/*.rb
|
816
|
+
VersionAdded: '1.37'
|
817
|
+
VersionChanged: '2.0'
|
818
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
819
|
+
|
820
|
+
RSpec/FactoryBot/SyntaxMethods:
|
821
|
+
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
822
|
+
Enabled: pending
|
823
|
+
SafeAutoCorrect: false
|
824
|
+
VersionAdded: '2.7'
|
825
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
|
826
|
+
|
827
|
+
RSpec/Rails:
|
828
|
+
Enabled: true
|
829
|
+
Include: *1
|
830
|
+
Language: *2
|
831
|
+
|
832
|
+
RSpec/Rails/AvoidSetupHook:
|
833
|
+
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
|
834
|
+
Enabled: pending
|
835
|
+
VersionAdded: '2.4'
|
836
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
|
837
|
+
|
838
|
+
RSpec/Rails/HttpStatus:
|
839
|
+
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
840
|
+
Enabled: true
|
841
|
+
EnforcedStyle: symbolic
|
842
|
+
SupportedStyles:
|
843
|
+
- numeric
|
844
|
+
- symbolic
|
845
|
+
VersionAdded: '1.23'
|
846
|
+
VersionChanged: '2.0'
|
847
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# GENERATED FILE - DO NOT EDIT
|
2
|
+
#
|
3
|
+
# This file should look just like: https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop-rspec.rb
|
4
|
+
# Except without the `Inject.defaults!` monkey patching.
|
5
|
+
#
|
6
|
+
# Because there are both necessary require statements and additional patching
|
7
|
+
# of RuboCop built-in cops in this file, we need to monitor it for changes
|
8
|
+
# in rubocop-rails and keep it up to date.
|
9
|
+
#
|
10
|
+
# Last updated from rubocop-rspec v2.22.0
|
11
|
+
|
12
|
+
# frozen_string_literal: true
|
13
|
+
|
14
|
+
require "pathname"
|
15
|
+
require "yaml"
|
16
|
+
|
17
|
+
require "rubocop"
|
18
|
+
require "rubocop-capybara"
|
19
|
+
require "rubocop-factory_bot"
|
20
|
+
|
21
|
+
require_path = Pathname.new(Gem.loaded_specs["rubocop-rspec"].full_require_paths.first)
|
22
|
+
require require_path.join("rubocop/rspec")
|
23
|
+
# require_relative 'rubocop/rspec/inject'
|
24
|
+
require require_path.join("rubocop/rspec/language/node_pattern")
|
25
|
+
require require_path.join("rubocop/rspec/node")
|
26
|
+
require require_path.join("rubocop/rspec/version")
|
27
|
+
require require_path.join("rubocop/rspec/wording")
|
28
|
+
|
29
|
+
# Dependent on `RuboCop::RSpec::Language::NodePattern`.
|
30
|
+
require require_path.join("rubocop/rspec/language")
|
31
|
+
|
32
|
+
require require_path.join("rubocop/cop/rspec/mixin/final_end_location")
|
33
|
+
require require_path.join("rubocop/cop/rspec/mixin/inside_example_group")
|
34
|
+
require require_path.join("rubocop/cop/rspec/mixin/location_help")
|
35
|
+
require require_path.join("rubocop/cop/rspec/mixin/metadata")
|
36
|
+
require require_path.join("rubocop/cop/rspec/mixin/namespace")
|
37
|
+
require require_path.join("rubocop/cop/rspec/mixin/skip_or_pending")
|
38
|
+
require require_path.join("rubocop/cop/rspec/mixin/top_level_group")
|
39
|
+
require require_path.join("rubocop/cop/rspec/mixin/variable")
|
40
|
+
|
41
|
+
# Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`.
|
42
|
+
require require_path.join("rubocop/cop/rspec/mixin/comments_help")
|
43
|
+
require require_path.join("rubocop/cop/rspec/mixin/empty_line_separation")
|
44
|
+
|
45
|
+
require require_path.join("rubocop/cop/rspec/base")
|
46
|
+
require require_path.join("rubocop/rspec/align_let_brace")
|
47
|
+
require require_path.join("rubocop/rspec/concept")
|
48
|
+
require require_path.join("rubocop/rspec/corrector/move_node")
|
49
|
+
require require_path.join("rubocop/rspec/example")
|
50
|
+
require require_path.join("rubocop/rspec/example_group")
|
51
|
+
require require_path.join("rubocop/rspec/hook")
|
52
|
+
|
53
|
+
# RuboCop::RSpec::Inject.defaults!
|
54
|
+
|
55
|
+
require require_path.join("rubocop/cop/rspec_cops")
|
56
|
+
|
57
|
+
# We have to register our autocorrect incompatibilities in RuboCop's cops
|
58
|
+
# as well so we do not hit infinite loops
|
59
|
+
|
60
|
+
RuboCop::Cop::Layout::ExtraSpacing.singleton_class.prepend(
|
61
|
+
Module.new do
|
62
|
+
def autocorrect_incompatible_with
|
63
|
+
super.push(RuboCop::Cop::RSpec::AlignLeftLetBrace)
|
64
|
+
.push(RuboCop::Cop::RSpec::AlignRightLetBrace)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
)
|
68
|
+
|
69
|
+
RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend(
|
70
|
+
Module.new do
|
71
|
+
def autocorrect_incompatible_with
|
72
|
+
super.push(RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
)
|
76
|
+
|
77
|
+
RuboCop::AST::Node.include(RuboCop::RSpec::Node)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Standard
|
4
|
+
module Rspec
|
5
|
+
class Plugin < LintRoller::Plugin
|
6
|
+
def about
|
7
|
+
LintRoller::About.new(
|
8
|
+
name: "standard-rspec",
|
9
|
+
version: VERSION,
|
10
|
+
homepage: "https://github.com/shilin-anton/standard-rspec",
|
11
|
+
description: "Configuration for rubocop-rspec rules"
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def supported?(context)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def rules(context)
|
20
|
+
trick_rubocop_into_thinking_we_required_rubocop_rspec!
|
21
|
+
|
22
|
+
LintRoller::Rules.new(
|
23
|
+
type: :object,
|
24
|
+
config_format: :rubocop,
|
25
|
+
value: YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# This is not fantastic.
|
32
|
+
#
|
33
|
+
# When you `require "rubocop-rspec"`, it will not only load the cops,
|
34
|
+
# but it will also monkey-patch RuboCop's default_configuration, which is
|
35
|
+
# something that can't be undone for the lifetime of the process.
|
36
|
+
#
|
37
|
+
# See: https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop-rspec.rb#L41
|
38
|
+
#
|
39
|
+
# As an alternative, standard-rspec loads the cops directly, and then
|
40
|
+
# simply tells the RuboCop config loader that it's been loaded. This is
|
41
|
+
# taking advantage of a private API of an `attr_reader` that probably wasn't
|
42
|
+
# meant to be mutated externally, but it's better than the `Inject` monkey
|
43
|
+
# patching that rubocop-rspec does (and many other RuboCop plugins do)
|
44
|
+
def trick_rubocop_into_thinking_we_required_rubocop_rspec!
|
45
|
+
without_warnings do
|
46
|
+
require_relative "load_rubocop_rspec_without_the_monkey_patch"
|
47
|
+
end
|
48
|
+
RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-rspec")
|
49
|
+
end
|
50
|
+
|
51
|
+
# This is also not fantastic, but because loading RuboCop before loading
|
52
|
+
# ActiveSupport will result in RuboCop redefining a number of ActiveSupport
|
53
|
+
# methods like String#blank?, we need to suppress the warnings that are
|
54
|
+
# emitted when we load the cops.
|
55
|
+
def without_warnings(&blk)
|
56
|
+
original_verbose = $VERBOSE
|
57
|
+
$VERBOSE = nil
|
58
|
+
yield
|
59
|
+
ensure
|
60
|
+
$VERBOSE = original_verbose
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "standard/rspec"
|
@@ -0,0 +1 @@
|
|
1
|
+
TODO
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/standard/rspec/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "standard-rspec"
|
7
|
+
spec.version = Standard::Rspec::VERSION
|
8
|
+
spec.authors = ["shilin-anton"]
|
9
|
+
spec.email = ["anton.d.shilin@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "A Standard plugin that adds rubocop-rspec specific rules to Standard."
|
12
|
+
spec.homepage = "https://github.com/shilin-anton/standard-rspec"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = ">= 2.7.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
19
|
+
|
20
|
+
spec.metadata["default_lint_roller_plugin"] = "Standard::Rspec::Plugin"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(File.expand_path(f) == __FILE__) ||
|
27
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_dependency "lint_roller", "~> 1.0"
|
35
|
+
spec.add_dependency "rubocop-rspec", "~> 2.22.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: standard-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- shilin-anton
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lint_roller
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.22.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.22.0
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- anton.d.shilin@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".standard.yml"
|
49
|
+
- CHANGELOG.md
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- config/base.yml
|
54
|
+
- lib/standard-rspec.rb
|
55
|
+
- lib/standard/rspec.rb
|
56
|
+
- lib/standard/rspec/load_rubocop_rspec_without_the_monkey_patch.rb
|
57
|
+
- lib/standard/rspec/plugin.rb
|
58
|
+
- lib/standard/rspec/version.rb
|
59
|
+
- sig/standard/rspec.rbs
|
60
|
+
- standard-rspec.gemspec
|
61
|
+
homepage: https://github.com/shilin-anton/standard-rspec
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata:
|
65
|
+
homepage_uri: https://github.com/shilin-anton/standard-rspec
|
66
|
+
source_code_uri: https://github.com/shilin-anton/standard-rspec
|
67
|
+
changelog_uri: https://github.com/shilin-anton/standard-rspec/blob/main/CHANGELOG.md
|
68
|
+
default_lint_roller_plugin: Standard::Rspec::Plugin
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.7.0
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.4.14
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: A Standard plugin that adds rubocop-rspec specific rules to Standard.
|
88
|
+
test_files: []
|