rubocop-minitest 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/minitest/assert_match.rb +1 -1
- data/lib/rubocop/cop/minitest/assert_raises_with_regexp_argument.rb +36 -0
- data/lib/rubocop/cop/minitest_cops.rb +1 -0
- data/lib/rubocop/cop/mixin/argument_range_helper.rb +1 -0
- data/lib/rubocop/cop/mixin/in_delta_mixin.rb +1 -0
- data/lib/rubocop/cop/mixin/minitest_cop_rule.rb +11 -4
- data/lib/rubocop/cop/mixin/minitest_exploration_helpers.rb +1 -0
- data/lib/rubocop/cop/mixin/nil_assertion_handleable.rb +1 -0
- data/lib/rubocop/cop/mixin/predicate_assertion_handleable.rb +1 -0
- data/lib/rubocop/minitest/version.rb +1 -1
- metadata +4 -81
- data/.circleci/config.yml +0 -55
- data/.gitattributes +0 -1
- data/.github/FUNDING.yml +0 -7
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -43
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- data/.github/workflows/linting.yml +0 -15
- data/.github/workflows/spell_checking.yml +0 -33
- data/.gitignore +0 -61
- data/.rubocop.yml +0 -110
- data/.rubocop_todo.yml +0 -19
- data/.yamllint.yml +0 -9
- data/.yardopts +0 -3
- data/CHANGELOG.md +0 -336
- data/CONTRIBUTING.md +0 -69
- data/Gemfile +0 -16
- data/Rakefile +0 -56
- data/bin/console +0 -11
- data/bin/setup +0 -8
- data/codespell.txt +0 -0
- data/docs/antora.yml +0 -7
- data/docs/modules/ROOT/nav.adoc +0 -6
- data/docs/modules/ROOT/pages/cops.adoc +0 -56
- data/docs/modules/ROOT/pages/cops_minitest.adoc +0 -1450
- data/docs/modules/ROOT/pages/index.adoc +0 -5
- data/docs/modules/ROOT/pages/installation.adoc +0 -15
- data/docs/modules/ROOT/pages/usage.adoc +0 -32
- data/legacy-docs/cops.md +0 -23
- data/legacy-docs/cops_minitest.md +0 -448
- data/legacy-docs/index.md +0 -1
- data/legacy-docs/installation.md +0 -11
- data/legacy-docs/usage.md +0 -27
- data/mkdocs.yml +0 -13
- data/readthedocs.yml +0 -5
- data/relnotes/v0.1.0.md +0 -7
- data/relnotes/v0.10.0.md +0 -21
- data/relnotes/v0.10.1.md +0 -5
- data/relnotes/v0.10.2.md +0 -5
- data/relnotes/v0.10.3.md +0 -5
- data/relnotes/v0.11.0.md +0 -16
- data/relnotes/v0.11.1.md +0 -5
- data/relnotes/v0.12.0.md +0 -10
- data/relnotes/v0.12.1.md +0 -5
- data/relnotes/v0.13.0.md +0 -5
- data/relnotes/v0.14.0.md +0 -5
- data/relnotes/v0.15.0.md +0 -5
- data/relnotes/v0.15.1.md +0 -5
- data/relnotes/v0.15.2.md +0 -5
- data/relnotes/v0.16.0.md +0 -11
- data/relnotes/v0.17.0.md +0 -5
- data/relnotes/v0.17.1.md +0 -5
- data/relnotes/v0.17.2.md +0 -5
- data/relnotes/v0.18.0.md +0 -9
- data/relnotes/v0.19.0.md +0 -5
- data/relnotes/v0.19.1.md +0 -5
- data/relnotes/v0.2.0.md +0 -9
- data/relnotes/v0.2.1.md +0 -5
- data/relnotes/v0.20.0.md +0 -13
- data/relnotes/v0.20.1.md +0 -5
- data/relnotes/v0.21.0.md +0 -5
- data/relnotes/v0.21.1.md +0 -5
- data/relnotes/v0.3.0.md +0 -16
- data/relnotes/v0.4.0.md +0 -14
- data/relnotes/v0.4.1.md +0 -5
- data/relnotes/v0.5.0.md +0 -5
- data/relnotes/v0.5.1.md +0 -5
- data/relnotes/v0.6.0.md +0 -5
- data/relnotes/v0.6.1.md +0 -6
- data/relnotes/v0.6.2.md +0 -5
- data/relnotes/v0.7.0.md +0 -13
- data/relnotes/v0.8.0.md +0 -12
- data/relnotes/v0.8.1.md +0 -5
- data/relnotes/v0.9.0.md +0 -10
- data/rubocop-minitest.gemspec +0 -40
- data/tasks/changelog.rake +0 -34
- data/tasks/changelog.rb +0 -166
- data/tasks/cops_documentation.rake +0 -50
- data/tasks/cut_release.rake +0 -86
@@ -1,15 +0,0 @@
|
|
1
|
-
= Installation
|
2
|
-
|
3
|
-
Just install the `rubocop-minitest` gem
|
4
|
-
|
5
|
-
[source,sh]
|
6
|
-
----
|
7
|
-
gem install rubocop-minitest
|
8
|
-
----
|
9
|
-
|
10
|
-
or if you use bundler put this in your `Gemfile`
|
11
|
-
|
12
|
-
[source,ruby]
|
13
|
-
----
|
14
|
-
gem 'rubocop-minitest', require: false
|
15
|
-
----
|
@@ -1,32 +0,0 @@
|
|
1
|
-
= Usage
|
2
|
-
|
3
|
-
You need to tell RuboCop to load the Minitest extension. There are three
|
4
|
-
ways to do this:
|
5
|
-
|
6
|
-
== RuboCop configuration file
|
7
|
-
|
8
|
-
Put this into your `.rubocop.yml`.
|
9
|
-
|
10
|
-
[source,yaml]
|
11
|
-
----
|
12
|
-
require: rubocop-minitest
|
13
|
-
----
|
14
|
-
|
15
|
-
Now you can run `rubocop` and it will automatically load the RuboCop Minitest
|
16
|
-
cops together with the standard cops.
|
17
|
-
|
18
|
-
== Command line
|
19
|
-
|
20
|
-
[source,sh]
|
21
|
-
----
|
22
|
-
rubocop --require rubocop-minitest
|
23
|
-
----
|
24
|
-
|
25
|
-
== Rake task
|
26
|
-
|
27
|
-
[source,ruby]
|
28
|
-
----
|
29
|
-
RuboCop::RakeTask.new do |task|
|
30
|
-
task.requires << 'rubocop-minitest'
|
31
|
-
end
|
32
|
-
----
|
data/legacy-docs/cops.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
<!-- START_COP_LIST -->
|
2
|
-
#### Department [Minitest](cops_minitest.md)
|
3
|
-
|
4
|
-
* [Minitest/AssertEmpty](cops_minitest.md#minitestassertempty)
|
5
|
-
* [Minitest/AssertEmptyLiteral](cops_minitest.md#minitestassertemptyliteral)
|
6
|
-
* [Minitest/AssertEqual](cops_minitest.md#minitestassertequal)
|
7
|
-
* [Minitest/AssertIncludes](cops_minitest.md#minitestassertincludes)
|
8
|
-
* [Minitest/AssertInstanceOf](cops_minitest.md#minitestassertinstanceof)
|
9
|
-
* [Minitest/AssertMatch](cops_minitest.md#minitestassertmatch)
|
10
|
-
* [Minitest/AssertNil](cops_minitest.md#minitestassertnil)
|
11
|
-
* [Minitest/AssertRespondTo](cops_minitest.md#minitestassertrespondto)
|
12
|
-
* [Minitest/AssertTruthy](cops_minitest.md#minitestasserttruthy)
|
13
|
-
* [Minitest/GlobalExpectations](cops_minitest.md#minitestglobalexpectations)
|
14
|
-
* [Minitest/RefuteEmpty](cops_minitest.md#minitestrefuteempty)
|
15
|
-
* [Minitest/RefuteEqual](cops_minitest.md#minitestrefuteequal)
|
16
|
-
* [Minitest/RefuteFalse](cops_minitest.md#minitestrefutefalse)
|
17
|
-
* [Minitest/RefuteIncludes](cops_minitest.md#minitestrefuteincludes)
|
18
|
-
* [Minitest/RefuteInstanceOf](cops_minitest.md#minitestrefuteinstanceof)
|
19
|
-
* [Minitest/RefuteMatch](cops_minitest.md#minitestrefutematch)
|
20
|
-
* [Minitest/RefuteNil](cops_minitest.md#minitestrefutenil)
|
21
|
-
* [Minitest/RefuteRespondTo](cops_minitest.md#minitestrefuterespondto)
|
22
|
-
|
23
|
-
<!-- END_COP_LIST -->
|
@@ -1,448 +0,0 @@
|
|
1
|
-
# Minitest
|
2
|
-
|
3
|
-
## Minitest/AssertEmpty
|
4
|
-
|
5
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
6
|
-
--- | --- | --- | --- | ---
|
7
|
-
Enabled | Yes | Yes | 0.2 | -
|
8
|
-
|
9
|
-
This cop enforces the test to use `assert_empty`
|
10
|
-
instead of using `assert(object.empty?)`.
|
11
|
-
|
12
|
-
### Examples
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
# bad
|
16
|
-
assert(object.empty?)
|
17
|
-
assert(object.empty?, 'message')
|
18
|
-
|
19
|
-
# good
|
20
|
-
assert_empty(object)
|
21
|
-
assert_empty(object, 'message')
|
22
|
-
```
|
23
|
-
|
24
|
-
### References
|
25
|
-
|
26
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-empty](https://github.com/rubocop/minitest-style-guide#assert-empty)
|
27
|
-
|
28
|
-
## Minitest/AssertEmptyLiteral
|
29
|
-
|
30
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
31
|
-
--- | --- | --- | --- | ---
|
32
|
-
Enabled | Yes | No | 0.5 | -
|
33
|
-
|
34
|
-
This cop enforces the test to use `assert_empty`
|
35
|
-
instead of using `assert([], object)`.
|
36
|
-
|
37
|
-
### Examples
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
# bad
|
41
|
-
assert([], object)
|
42
|
-
assert({}, object)
|
43
|
-
|
44
|
-
# good
|
45
|
-
assert_empty(object)
|
46
|
-
```
|
47
|
-
|
48
|
-
## Minitest/AssertEqual
|
49
|
-
|
50
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
51
|
-
--- | --- | --- | --- | ---
|
52
|
-
Enabled | Yes | Yes | 0.4 | -
|
53
|
-
|
54
|
-
This cop enforces the use of `assert_equal(expected, actual)`
|
55
|
-
over `assert(expected == actual)`.
|
56
|
-
|
57
|
-
### Examples
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
# bad
|
61
|
-
assert("rubocop-minitest" == actual)
|
62
|
-
|
63
|
-
# good
|
64
|
-
assert_equal("rubocop-minitest", actual)
|
65
|
-
```
|
66
|
-
|
67
|
-
### References
|
68
|
-
|
69
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-equal-arguments-order](https://github.com/rubocop/minitest-style-guide#assert-equal-arguments-order)
|
70
|
-
|
71
|
-
## Minitest/AssertIncludes
|
72
|
-
|
73
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
74
|
-
--- | --- | --- | --- | ---
|
75
|
-
Enabled | Yes | Yes | 0.2 | -
|
76
|
-
|
77
|
-
This cop enforces the test to use `assert_includes`
|
78
|
-
instead of using `assert(collection.include?(object))`.
|
79
|
-
|
80
|
-
### Examples
|
81
|
-
|
82
|
-
```ruby
|
83
|
-
# bad
|
84
|
-
assert(collection.include?(object))
|
85
|
-
assert(collection.include?(object), 'message')
|
86
|
-
|
87
|
-
# good
|
88
|
-
assert_includes(collection, object)
|
89
|
-
assert_includes(collection, object, 'message')
|
90
|
-
```
|
91
|
-
|
92
|
-
### References
|
93
|
-
|
94
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-includes](https://github.com/rubocop/minitest-style-guide#assert-includes)
|
95
|
-
|
96
|
-
## Minitest/AssertInstanceOf
|
97
|
-
|
98
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
99
|
-
--- | --- | --- | --- | ---
|
100
|
-
Enabled | Yes | Yes | 0.4 | -
|
101
|
-
|
102
|
-
This cop enforces the test to use `assert_instance_of(Class, object)`
|
103
|
-
over `assert(object.instance_of?(Class))`.
|
104
|
-
|
105
|
-
### Examples
|
106
|
-
|
107
|
-
```ruby
|
108
|
-
# bad
|
109
|
-
assert(object.instance_of?(Class))
|
110
|
-
assert(object.instance_of?(Class), 'message')
|
111
|
-
|
112
|
-
# good
|
113
|
-
assert_instance_of(Class, object)
|
114
|
-
assert_instance_of(Class, object, 'message')
|
115
|
-
```
|
116
|
-
|
117
|
-
### References
|
118
|
-
|
119
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-instance-of](https://github.com/rubocop/minitest-style-guide#assert-instance-of)
|
120
|
-
|
121
|
-
## Minitest/AssertMatch
|
122
|
-
|
123
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
124
|
-
--- | --- | --- | --- | ---
|
125
|
-
Enabled | Yes | Yes | 0.6 | -
|
126
|
-
|
127
|
-
This cop enforces the test to use `assert_match`
|
128
|
-
instead of using `assert(matcher.match(string))`.
|
129
|
-
|
130
|
-
### Examples
|
131
|
-
|
132
|
-
```ruby
|
133
|
-
# bad
|
134
|
-
assert(matcher.match(string))
|
135
|
-
assert(matcher.match(string), 'message')
|
136
|
-
|
137
|
-
# good
|
138
|
-
assert_match(regex, string)
|
139
|
-
assert_match(matcher, string, 'message')
|
140
|
-
```
|
141
|
-
|
142
|
-
### References
|
143
|
-
|
144
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-match](https://github.com/rubocop/minitest-style-guide#assert-match)
|
145
|
-
|
146
|
-
## Minitest/AssertNil
|
147
|
-
|
148
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
149
|
-
--- | --- | --- | --- | ---
|
150
|
-
Enabled | Yes | Yes | 0.1 | -
|
151
|
-
|
152
|
-
This cop enforces the test to use `assert_nil`
|
153
|
-
instead of using `assert_equal(nil, something)`.
|
154
|
-
|
155
|
-
### Examples
|
156
|
-
|
157
|
-
```ruby
|
158
|
-
# bad
|
159
|
-
assert_equal(nil, actual)
|
160
|
-
assert_equal(nil, actual, 'message')
|
161
|
-
|
162
|
-
# good
|
163
|
-
assert_nil(actual)
|
164
|
-
assert_nil(actual, 'message')
|
165
|
-
```
|
166
|
-
|
167
|
-
### References
|
168
|
-
|
169
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-nil](https://github.com/rubocop/minitest-style-guide#assert-nil)
|
170
|
-
|
171
|
-
## Minitest/AssertRespondTo
|
172
|
-
|
173
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
174
|
-
--- | --- | --- | --- | ---
|
175
|
-
Enabled | Yes | Yes | 0.3 | -
|
176
|
-
|
177
|
-
This cop enforces the use of `assert_respond_to(object, :do_something)`
|
178
|
-
over `assert(object.respond_to?(:do_something))`.
|
179
|
-
|
180
|
-
### Examples
|
181
|
-
|
182
|
-
```ruby
|
183
|
-
# bad
|
184
|
-
assert(object.respond_to?(:do_something))
|
185
|
-
assert(object.respond_to?(:do_something), 'message')
|
186
|
-
assert(respond_to?(:do_something))
|
187
|
-
|
188
|
-
# good
|
189
|
-
assert_respond_to(object, :do_something)
|
190
|
-
assert_respond_to(object, :do_something, 'message')
|
191
|
-
assert_respond_to(self, :do_something)
|
192
|
-
```
|
193
|
-
|
194
|
-
### References
|
195
|
-
|
196
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-responds-to-method](https://github.com/rubocop/minitest-style-guide#assert-responds-to-method)
|
197
|
-
|
198
|
-
## Minitest/AssertTruthy
|
199
|
-
|
200
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
201
|
-
--- | --- | --- | --- | ---
|
202
|
-
Enabled | Yes | Yes | 0.2 | -
|
203
|
-
|
204
|
-
This cop enforces the test to use `assert(actual)`
|
205
|
-
instead of using `assert_equal(true, actual)`.
|
206
|
-
|
207
|
-
### Examples
|
208
|
-
|
209
|
-
```ruby
|
210
|
-
# bad
|
211
|
-
assert_equal(true, actual)
|
212
|
-
assert_equal(true, actual, 'message')
|
213
|
-
|
214
|
-
# good
|
215
|
-
assert(actual)
|
216
|
-
assert(actual, 'message')
|
217
|
-
```
|
218
|
-
|
219
|
-
### References
|
220
|
-
|
221
|
-
* [https://github.com/rubocop/minitest-style-guide#assert-truthy](https://github.com/rubocop/minitest-style-guide#assert-truthy)
|
222
|
-
|
223
|
-
## Minitest/GlobalExpectations
|
224
|
-
|
225
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
226
|
-
--- | --- | --- | --- | ---
|
227
|
-
Enabled | Yes | Yes | 0.7 | -
|
228
|
-
|
229
|
-
This cop checks for deprecated global expectations
|
230
|
-
and autocorrects them to use expect format.
|
231
|
-
|
232
|
-
### Examples
|
233
|
-
|
234
|
-
```ruby
|
235
|
-
# bad
|
236
|
-
musts.must_equal expected_musts
|
237
|
-
wonts.wont_match expected_wonts
|
238
|
-
musts.must_raise TypeError
|
239
|
-
|
240
|
-
# good
|
241
|
-
_(musts).must_equal expected_musts
|
242
|
-
_(wonts).wont_match expected_wonts
|
243
|
-
_ { musts }.must_raise TypeError
|
244
|
-
```
|
245
|
-
|
246
|
-
## Minitest/RefuteEmpty
|
247
|
-
|
248
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
249
|
-
--- | --- | --- | --- | ---
|
250
|
-
Enabled | Yes | Yes | 0.3 | -
|
251
|
-
|
252
|
-
This cop enforces to use `refute_empty` instead of
|
253
|
-
using `refute(object.empty?)`.
|
254
|
-
|
255
|
-
### Examples
|
256
|
-
|
257
|
-
```ruby
|
258
|
-
# bad
|
259
|
-
refute(object.empty?)
|
260
|
-
refute(object.empty?, 'message')
|
261
|
-
|
262
|
-
# good
|
263
|
-
refute_empty(object)
|
264
|
-
refute_empty(object, 'message')
|
265
|
-
```
|
266
|
-
|
267
|
-
### References
|
268
|
-
|
269
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-empty](https://github.com/rubocop/minitest-style-guide#refute-empty)
|
270
|
-
|
271
|
-
## Minitest/RefuteEqual
|
272
|
-
|
273
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
274
|
-
--- | --- | --- | --- | ---
|
275
|
-
Enabled | Yes | Yes | 0.3 | -
|
276
|
-
|
277
|
-
This cop enforces the use of `refute_equal(expected, object)`
|
278
|
-
over `assert_equal(expected != actual)` or `assert(! expected == actual)`.
|
279
|
-
|
280
|
-
### Examples
|
281
|
-
|
282
|
-
```ruby
|
283
|
-
# bad
|
284
|
-
assert("rubocop-minitest" != actual)
|
285
|
-
assert(! "rubocop-minitest" == actual)
|
286
|
-
|
287
|
-
# good
|
288
|
-
refute_equal("rubocop-minitest", actual)
|
289
|
-
```
|
290
|
-
|
291
|
-
### References
|
292
|
-
|
293
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-equal](https://github.com/rubocop/minitest-style-guide#refute-equal)
|
294
|
-
|
295
|
-
## Minitest/RefuteFalse
|
296
|
-
|
297
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
298
|
-
--- | --- | --- | --- | ---
|
299
|
-
Enabled | Yes | Yes | 0.3 | -
|
300
|
-
|
301
|
-
This cop enforces the use of `refute(object)`
|
302
|
-
over `assert_equal(false, object)`.
|
303
|
-
|
304
|
-
### Examples
|
305
|
-
|
306
|
-
```ruby
|
307
|
-
# bad
|
308
|
-
assert_equal(false, actual)
|
309
|
-
assert_equal(false, actual, 'message')
|
310
|
-
|
311
|
-
assert(!test)
|
312
|
-
assert(!test, 'message')
|
313
|
-
|
314
|
-
# good
|
315
|
-
refute(actual)
|
316
|
-
refute(actual, 'message')
|
317
|
-
```
|
318
|
-
|
319
|
-
### References
|
320
|
-
|
321
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-false](https://github.com/rubocop/minitest-style-guide#refute-false)
|
322
|
-
|
323
|
-
## Minitest/RefuteIncludes
|
324
|
-
|
325
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
326
|
-
--- | --- | --- | --- | ---
|
327
|
-
Enabled | Yes | Yes | 0.3 | -
|
328
|
-
|
329
|
-
This cop enforces the test to use `refute_includes`
|
330
|
-
instead of using `refute(collection.include?(object))`.
|
331
|
-
|
332
|
-
### Examples
|
333
|
-
|
334
|
-
```ruby
|
335
|
-
# bad
|
336
|
-
refute(collection.include?(object))
|
337
|
-
refute(collection.include?(object), 'message')
|
338
|
-
|
339
|
-
# good
|
340
|
-
refute_includes(collection, object)
|
341
|
-
refute_includes(collection, object, 'message')
|
342
|
-
```
|
343
|
-
|
344
|
-
### References
|
345
|
-
|
346
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-includes](https://github.com/rubocop/minitest-style-guide#refute-includes)
|
347
|
-
|
348
|
-
## Minitest/RefuteInstanceOf
|
349
|
-
|
350
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
351
|
-
--- | --- | --- | --- | ---
|
352
|
-
Enabled | Yes | Yes | 0.4 | -
|
353
|
-
|
354
|
-
This cop enforces the use of `refute_instance_of(Class, object)`
|
355
|
-
over `refute(object.instance_of?(Class))`.
|
356
|
-
|
357
|
-
### Examples
|
358
|
-
|
359
|
-
```ruby
|
360
|
-
# bad
|
361
|
-
refute(object.instance_of?(Class))
|
362
|
-
refute(object.instance_of?(Class), 'message')
|
363
|
-
|
364
|
-
# good
|
365
|
-
refute_instance_of(Class, object)
|
366
|
-
refute_instance_of(Class, object, 'message')
|
367
|
-
```
|
368
|
-
|
369
|
-
### References
|
370
|
-
|
371
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-instance-of](https://github.com/rubocop/minitest-style-guide#refute-instance-of)
|
372
|
-
|
373
|
-
## Minitest/RefuteMatch
|
374
|
-
|
375
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
376
|
-
--- | --- | --- | --- | ---
|
377
|
-
Enabled | Yes | Yes | 0.6 | -
|
378
|
-
|
379
|
-
This cop enforces the test to use `refute_match`
|
380
|
-
instead of using `refute(matcher.match(string))`.
|
381
|
-
|
382
|
-
### Examples
|
383
|
-
|
384
|
-
```ruby
|
385
|
-
# bad
|
386
|
-
refute(matcher.match(string))
|
387
|
-
refute(matcher.match(string), 'message')
|
388
|
-
|
389
|
-
# good
|
390
|
-
refute_match(matcher, string)
|
391
|
-
refute_match(matcher, string, 'message')
|
392
|
-
```
|
393
|
-
|
394
|
-
### References
|
395
|
-
|
396
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-match](https://github.com/rubocop/minitest-style-guide#refute-match)
|
397
|
-
|
398
|
-
## Minitest/RefuteNil
|
399
|
-
|
400
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
401
|
-
--- | --- | --- | --- | ---
|
402
|
-
Enabled | Yes | Yes | 0.2 | -
|
403
|
-
|
404
|
-
This cop enforces the test to use `refute_nil`
|
405
|
-
instead of using `refute_equal(nil, something)`.
|
406
|
-
|
407
|
-
### Examples
|
408
|
-
|
409
|
-
```ruby
|
410
|
-
# bad
|
411
|
-
refute_equal(nil, actual)
|
412
|
-
refute_equal(nil, actual, 'message')
|
413
|
-
|
414
|
-
# good
|
415
|
-
refute_nil(actual)
|
416
|
-
refute_nil(actual, 'message')
|
417
|
-
```
|
418
|
-
|
419
|
-
### References
|
420
|
-
|
421
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-nil](https://github.com/rubocop/minitest-style-guide#refute-nil)
|
422
|
-
|
423
|
-
## Minitest/RefuteRespondTo
|
424
|
-
|
425
|
-
Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
426
|
-
--- | --- | --- | --- | ---
|
427
|
-
Enabled | Yes | Yes | 0.4 | -
|
428
|
-
|
429
|
-
This cop enforces the test to use `refute_respond_to(object, :do_something)`
|
430
|
-
over `refute(object.respond_to?(:do_something))`.
|
431
|
-
|
432
|
-
### Examples
|
433
|
-
|
434
|
-
```ruby
|
435
|
-
# bad
|
436
|
-
refute(object.respond_to?(:do_something))
|
437
|
-
refute(object.respond_to?(:do_something), 'message')
|
438
|
-
refute(respond_to?(:do_something))
|
439
|
-
|
440
|
-
# good
|
441
|
-
refute_respond_to(object, :do_something)
|
442
|
-
refute_respond_to(object, :do_something, 'message')
|
443
|
-
refute_respond_to(self, :do_something)
|
444
|
-
```
|
445
|
-
|
446
|
-
### References
|
447
|
-
|
448
|
-
* [https://github.com/rubocop/minitest-style-guide#refute-respond-to](https://github.com/rubocop/minitest-style-guide#refute-respond-to)
|
data/legacy-docs/index.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
A [RuboCop](https://github.com/rubocop/rubocop) extension focused on enforcing Minitest best practices and coding conventions.
|
data/legacy-docs/installation.md
DELETED
data/legacy-docs/usage.md
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
You need to tell RuboCop to load the Minitest extension. There are three
|
2
|
-
ways to do this:
|
3
|
-
|
4
|
-
### RuboCop configuration file
|
5
|
-
|
6
|
-
Put this into your `.rubocop.yml`.
|
7
|
-
|
8
|
-
```yaml
|
9
|
-
require: rubocop-minitest
|
10
|
-
```
|
11
|
-
|
12
|
-
Now you can run `rubocop` and it will automatically load the RuboCop Minitest
|
13
|
-
cops together with the standard cops.
|
14
|
-
|
15
|
-
### Command line
|
16
|
-
|
17
|
-
```sh
|
18
|
-
rubocop --require rubocop-minitest
|
19
|
-
```
|
20
|
-
|
21
|
-
### Rake task
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
RuboCop::RakeTask.new do |task|
|
25
|
-
task.requires << 'rubocop-minitest'
|
26
|
-
end
|
27
|
-
```
|
data/mkdocs.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
site_name: "A RuboCop extension focused on enforcing Minitest best practices and coding conventions."
|
2
|
-
repo_url: https://github.com/rubocop/rubocop-minitest
|
3
|
-
edit_uri: edit/master/legacy-docs/
|
4
|
-
copyright: "Copyright © 2022 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO, and RuboCop contributors"
|
5
|
-
docs_dir: legacy-docs
|
6
|
-
pages:
|
7
|
-
- Home: index.md
|
8
|
-
- Installation: installation.md
|
9
|
-
- Usage: usage.md
|
10
|
-
- Cops: cops.md
|
11
|
-
- Cops Documentation:
|
12
|
-
- Minitest Cops: cops_minitest.md
|
13
|
-
theme: readthedocs
|
data/readthedocs.yml
DELETED
data/relnotes/v0.1.0.md
DELETED
data/relnotes/v0.10.0.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
### New features
|
2
|
-
|
3
|
-
* [#92](https://github.com/rubocop/rubocop-minitest/pull/92): Add new `Minitest/LiteralAsActualArgument` cop. ([@fatkodima][], [@tsmmark][])
|
4
|
-
* [#95](https://github.com/rubocop/rubocop-minitest/pull/95): Add new `Minitest/AssertionInLifecycleHook` cop. ([@fatkodima][])
|
5
|
-
* [#91](https://github.com/rubocop/rubocop-minitest/pull/91): Add new `Minitest/AssertInDelta` and `Minitest/RefuteInDelta` cops. ([@fatkodima][])
|
6
|
-
* [#89](https://github.com/rubocop/rubocop-minitest/pull/89): Add new `Minitest/TestMethodName` cop. ([@fatkodima][])
|
7
|
-
* [#83](https://github.com/rubocop/rubocop-minitest/pull/83): New cops `AssertPathExists` and `RefutePathExists` check for use of `assert_path_exists`/`refute_path_exists` instead of `assert(File.exist?(path))`/`refute(File.exist?(path))`. ([@fatkodima][])
|
8
|
-
* [#88](https://github.com/rubocop/rubocop-minitest/pull/88): Add new `Minitest/MultipleAssertions` cop. ([@fatkodima][])
|
9
|
-
* [#87](https://github.com/rubocop/rubocop-minitest/pull/87): Add new `Minitest/AssertSilent` cop. ([@fatkodima][])
|
10
|
-
* [#96](https://github.com/rubocop/rubocop-minitest/pull/96): Add new `Minitest/UnspecifiedException` cop. ([@fatkodima][])
|
11
|
-
* [#98](https://github.com/rubocop/rubocop-minitest/pull/98): Add new `Minitest/AssertOutput` cop. ([@fatkodima][])
|
12
|
-
* [#84](https://github.com/rubocop/rubocop-minitest/pull/84): New cops `AssertKindOf` and `RefuteKindOf` check for use of `assert_kind_of`/`refute_kind_of` instead of `assert(foo.kind_of?(Class))`/`refute(foo.kind_of?(Class))`. ([@fatkodima][])
|
13
|
-
* [#85](https://github.com/rubocop/rubocop-minitest/pull/85): Add autocorrect to `Rails/AssertEmptyLiteral` cop. ([@fatkodima][])
|
14
|
-
|
15
|
-
### Changes
|
16
|
-
|
17
|
-
* [#104](https://github.com/rubocop/rubocop-minitest/pull/104): Require RuboCop 0.87 or higher. ([@koic][])
|
18
|
-
|
19
|
-
[@fatkodima]: https://github.com/fatkodima
|
20
|
-
[@tsmmark]: https://github.com/tsmmark
|
21
|
-
[@koic]: https://github.com/koic
|
data/relnotes/v0.10.1.md
DELETED
data/relnotes/v0.10.2.md
DELETED
data/relnotes/v0.10.3.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
### Bug fixes
|
2
|
-
|
3
|
-
* [#115](https://github.com/rubocop/rubocop-minitest/issues/115): Fix a false positive for `Minitest/TestMethodName` for when defining test method has an argument, and test method without assertion methods. ([@koic][])
|
4
|
-
|
5
|
-
[@koic]: https://github.com/koic
|
data/relnotes/v0.11.0.md
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
### New features
|
2
|
-
|
3
|
-
* [#117](https://github.com/rubocop/rubocop-minitest/issues/117): Add new cop `Minitest/AssertWithExpectedArgument` to check for unintended usages of `assert` instead of `assert_equal`. ([@cstyles][])
|
4
|
-
|
5
|
-
### Bug fixes
|
6
|
-
|
7
|
-
* [#122](https://github.com/rubocop/rubocop-minitest/pull/122): Fix `Minitest/TestMethodName` for tests with multiple assertions. ([@ghiculescu][])
|
8
|
-
|
9
|
-
### Changes
|
10
|
-
|
11
|
-
* [#118](https://github.com/rubocop/rubocop-minitest/pull/118): **(BREAKING)** Fix `Minitest/AssertEmptyLiteral` by making it check for `assert_equal([], array)` instead of `assert([], array)`. ([@cstyles][])
|
12
|
-
* [#125](https://github.com/rubocop/rubocop-minitest/pull/125): Require RuboCop 0.90 or higher. ([@koic][])
|
13
|
-
|
14
|
-
[@cstyles]: https://github.com/cstyles
|
15
|
-
[@ghiculescu]: https://github.com/ghiculescu
|
16
|
-
[@koic]: https://github.com/koic
|
data/relnotes/v0.11.1.md
DELETED
data/relnotes/v0.12.0.md
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
### New features
|
2
|
-
|
3
|
-
* [#124](https://github.com/rubocop/rubocop-minitest/pull/124): Add new `Minitest/NoAssertions` cop. ([@ghiculescu][])
|
4
|
-
|
5
|
-
### Changes
|
6
|
-
|
7
|
-
* [#129](https://github.com/rubocop/rubocop-minitest/pull/129): **(Compatibility)** Drop Ruby 2.4 support. ([@koic][])
|
8
|
-
|
9
|
-
[@ghiculescu]: https://github.com/ghiculescu
|
10
|
-
[@koic]: https://github.com/koic
|
data/relnotes/v0.12.1.md
DELETED
data/relnotes/v0.13.0.md
DELETED