rubocop-minitest 0.10.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +5 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +69 -52
- data/CONTRIBUTING.md +3 -3
- data/Gemfile +2 -2
- data/README.md +4 -4
- data/Rakefile +1 -1
- data/bin/console +2 -0
- data/config/default.yml +9 -4
- data/docs/antora.yml +1 -1
- data/docs/modules/ROOT/pages/cops.adoc +1 -0
- data/docs/modules/ROOT/pages/cops_minitest.adoc +36 -7
- data/docs/modules/ROOT/pages/index.adoc +1 -1
- data/legacy-docs/cops_minitest.md +16 -16
- data/legacy-docs/index.md +1 -1
- data/lib/rubocop/cop/minitest/assert_empty_literal.rb +9 -8
- data/lib/rubocop/cop/minitest/assert_in_delta.rb +2 -0
- data/lib/rubocop/cop/minitest/assert_nil.rb +1 -0
- data/lib/rubocop/cop/minitest/assert_path_exists.rb +1 -0
- data/lib/rubocop/cop/minitest/assert_truthy.rb +1 -0
- data/lib/rubocop/cop/minitest/assert_with_expected_argument.rb +38 -0
- data/lib/rubocop/cop/minitest/global_expectations.rb +2 -0
- data/lib/rubocop/cop/minitest/literal_as_actual_argument.rb +1 -0
- data/lib/rubocop/cop/minitest/refute_equal.rb +1 -0
- data/lib/rubocop/cop/minitest/refute_false.rb +1 -0
- data/lib/rubocop/cop/minitest/refute_in_delta.rb +2 -0
- data/lib/rubocop/cop/minitest/refute_nil.rb +1 -0
- data/lib/rubocop/cop/minitest/refute_path_exists.rb +1 -0
- data/lib/rubocop/cop/minitest/test_method_name.rb +1 -1
- data/lib/rubocop/cop/minitest_cops.rb +1 -0
- data/lib/rubocop/cop/mixin/minitest_cop_rule.rb +1 -0
- data/lib/rubocop/minitest/version.rb +1 -1
- data/mkdocs.yml +1 -1
- data/relnotes/v0.1.0.md +1 -1
- data/relnotes/v0.10.0.md +12 -12
- data/relnotes/v0.10.1.md +1 -1
- data/relnotes/v0.10.2.md +1 -1
- data/relnotes/v0.10.3.md +1 -1
- data/relnotes/v0.11.0.md +16 -0
- data/relnotes/v0.2.0.md +4 -4
- data/relnotes/v0.2.1.md +1 -1
- data/relnotes/v0.3.0.md +6 -6
- data/relnotes/v0.4.0.md +5 -5
- data/relnotes/v0.4.1.md +1 -1
- data/relnotes/v0.5.0.md +1 -1
- data/relnotes/v0.5.1.md +1 -1
- data/relnotes/v0.6.0.md +1 -1
- data/relnotes/v0.6.1.md +2 -2
- data/relnotes/v0.6.2.md +1 -1
- data/relnotes/v0.7.0.md +5 -5
- data/relnotes/v0.8.0.md +4 -4
- data/relnotes/v0.8.1.md +1 -1
- data/relnotes/v0.9.0.md +3 -3
- data/rubocop-minitest.gemspec +4 -4
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e45de61660959fcc0e02a2dd6754d7042cb167b1ef5277d327563e8bb2277c
|
4
|
+
data.tar.gz: 0f36c86abdde0b5b23dd2672f295a4383da2f5ff68b8414e96bb4f932c4eb7bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c643b9d4e81ce5f966e11cebe55c40359799130eba6591a52cf7b10dca759b289167ede842a89eb3bf0f62119fbc189a28e1da611cb82afaa825662bc271aa6a
|
7
|
+
data.tar.gz: 15aab2f0884dd25ef98e61b1728736f21311004c06d1d8b86454bb2bc4f9367e31e558b8843315fb1f3d7502f11ffea5ec1cbfb5acddd966bf373c4ad0b01482
|
@@ -32,8 +32,12 @@ a problem will expedite its solution.
|
|
32
32
|
## RuboCop version
|
33
33
|
|
34
34
|
Include the output of `rubocop -V` or `bundle exec rubocop -V` if using Bundler. Here's an example:
|
35
|
+
You see extension cop versions (e.g. rubocop-minitest, rubocop-performance, and others) output by rubocop -V,
|
36
|
+
include them as well. Here's an example:
|
35
37
|
|
36
38
|
```
|
37
39
|
$ [bundle exec] rubocop -V
|
38
|
-
|
40
|
+
1.10.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 3.0.0 x86_64-darwin19)
|
41
|
+
- rubocop-minitest 0.10.3
|
42
|
+
- rubocop-performance 1.9.2
|
39
43
|
```
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,171 +2,186 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.11.0 (2021-03-22)
|
6
|
+
|
7
|
+
### New features
|
8
|
+
|
9
|
+
* [#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][])
|
10
|
+
|
11
|
+
### Bug fixes
|
12
|
+
|
13
|
+
* [#122](https://github.com/rubocop/rubocop-minitest/pull/122): Fix `Minitest/TestMethodName` for tests with multiple assertions. ([@ghiculescu][])
|
14
|
+
|
15
|
+
### Changes
|
16
|
+
|
17
|
+
* [#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][])
|
18
|
+
* [#125](https://github.com/rubocop/rubocop-minitest/pull/125): Require RuboCop 0.90 or higher. ([@koic][])
|
19
|
+
|
5
20
|
## 0.10.3 (2021-01-12)
|
6
21
|
|
7
22
|
### Bug fixes
|
8
23
|
|
9
|
-
* [#115](https://github.com/rubocop
|
24
|
+
* [#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][])
|
10
25
|
|
11
26
|
## 0.10.2 (2020-12-27)
|
12
27
|
|
13
28
|
### Bug fixes
|
14
29
|
|
15
|
-
* [#113](https://github.com/rubocop
|
30
|
+
* [#113](https://github.com/rubocop/rubocop-minitest/issues/113): Fix an error for `Minitest/AssertEqual` and some cops when using `assert` with block argument. ([@koic][])
|
16
31
|
|
17
32
|
## 0.10.1 (2020-07-25)
|
18
33
|
|
19
34
|
### Bug fixes
|
20
35
|
|
21
|
-
* [#106](https://github.com/rubocop
|
36
|
+
* [#106](https://github.com/rubocop/rubocop-minitest/issues/106): Fix an error for `Minitest/AssertOutput` when using gvar at top level. ([@koic][])
|
22
37
|
|
23
38
|
## 0.10.0 (2020-07-12)
|
24
39
|
|
25
40
|
### New features
|
26
41
|
|
27
|
-
* [#92](https://github.com/rubocop
|
28
|
-
* [#95](https://github.com/rubocop
|
29
|
-
* [#91](https://github.com/rubocop
|
30
|
-
* [#89](https://github.com/rubocop
|
31
|
-
* [#83](https://github.com/rubocop
|
32
|
-
* [#88](https://github.com/rubocop
|
33
|
-
* [#87](https://github.com/rubocop
|
34
|
-
* [#96](https://github.com/rubocop
|
35
|
-
* [#98](https://github.com/rubocop
|
36
|
-
* [#84](https://github.com/rubocop
|
37
|
-
* [#85](https://github.com/rubocop
|
42
|
+
* [#92](https://github.com/rubocop/rubocop-minitest/pull/92): Add new `Minitest/LiteralAsActualArgument` cop. ([@fatkodima][], [@tsmmark][])
|
43
|
+
* [#95](https://github.com/rubocop/rubocop-minitest/pull/95): Add new `Minitest/AssertionInLifecycleHook` cop. ([@fatkodima][])
|
44
|
+
* [#91](https://github.com/rubocop/rubocop-minitest/pull/91): Add new `Minitest/AssertInDelta` and `Minitest/RefuteInDelta` cops. ([@fatkodima][])
|
45
|
+
* [#89](https://github.com/rubocop/rubocop-minitest/pull/89): Add new `Minitest/TestMethodName` cop. ([@fatkodima][])
|
46
|
+
* [#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][])
|
47
|
+
* [#88](https://github.com/rubocop/rubocop-minitest/pull/88): Add new `Minitest/MultipleAssertions` cop. ([@fatkodima][])
|
48
|
+
* [#87](https://github.com/rubocop/rubocop-minitest/pull/87): Add new `Minitest/AssertSilent` cop. ([@fatkodima][])
|
49
|
+
* [#96](https://github.com/rubocop/rubocop-minitest/pull/96): Add new `Minitest/UnspecifiedException` cop. ([@fatkodima][])
|
50
|
+
* [#98](https://github.com/rubocop/rubocop-minitest/pull/98): Add new `Minitest/AssertOutput` cop. ([@fatkodima][])
|
51
|
+
* [#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][])
|
52
|
+
* [#85](https://github.com/rubocop/rubocop-minitest/pull/85): Add autocorrect to `Rails/AssertEmptyLiteral` cop. ([@fatkodima][])
|
38
53
|
|
39
54
|
### Changes
|
40
55
|
|
41
|
-
* [#104](https://github.com/rubocop
|
56
|
+
* [#104](https://github.com/rubocop/rubocop-minitest/pull/104): Require RuboCop 0.87 or higher. ([@koic][])
|
42
57
|
|
43
58
|
## 0.9.0 (2020-04-13)
|
44
59
|
|
45
60
|
### Bug fixes
|
46
61
|
|
47
|
-
* [#75](https://github.com/rubocop
|
62
|
+
* [#75](https://github.com/rubocop/rubocop-minitest/issues/75): Fix a false negative for `Minitest/GlobalExpectations` when using global expectation methods with no arguments. ([@koic][])
|
48
63
|
|
49
64
|
### Changes
|
50
65
|
|
51
|
-
* [#73](https://github.com/rubocop
|
52
|
-
* [#77](https://github.com/rubocop
|
66
|
+
* [#73](https://github.com/rubocop/rubocop-minitest/issues/73): The Minitest department works on file names end with `_test.rb` by default. ([@koic][])
|
67
|
+
* [#77](https://github.com/rubocop/rubocop-minitest/pull/77): **(BREAKING)** Drop support for Ruby 2.3. ([@koic][])
|
53
68
|
|
54
69
|
## 0.8.1 (2020-04-06)
|
55
70
|
|
56
71
|
### Bug fixes
|
57
72
|
|
58
|
-
* [#72](https://github.com/rubocop
|
73
|
+
* [#72](https://github.com/rubocop/rubocop-minitest/pull/72): Fix some false negatives for `Minitest/GlobalExpectations`. ([@andrykonchin][])
|
59
74
|
|
60
75
|
## 0.8.0 (2020-03-24)
|
61
76
|
|
62
77
|
### New features
|
63
78
|
|
64
|
-
* [#66](https://github.com/rubocop
|
79
|
+
* [#66](https://github.com/rubocop/rubocop-minitest/issues/66): Support all expectations of `Minitest::Expectations` for `Minitest/GlobalExpectations` cop. ([@koic][])
|
65
80
|
|
66
81
|
### Bug fixes
|
67
82
|
|
68
|
-
* [#60](https://github.com/rubocop
|
69
|
-
* [#69](https://github.com/rubocop
|
70
|
-
* [#71](https://github.com/rubocop
|
83
|
+
* [#60](https://github.com/rubocop/rubocop-minitest/issues/60): Fix `Minitest/GlobalExpectations` autocorrection for chained methods. ([@tejasbubane][])
|
84
|
+
* [#69](https://github.com/rubocop/rubocop-minitest/pull/69): Fix a false negative for `Minitest/GlobalExpectations` cop when using a variable or a hash index for receiver. ([@koic][])
|
85
|
+
* [#71](https://github.com/rubocop/rubocop-minitest/pull/71): Fix a false negative for `Minitest/AssertEqual` when an argument is enclosed in redundant parentheses. ([@koic][])
|
71
86
|
|
72
87
|
## 0.7.0 (2020-03-09)
|
73
88
|
|
74
89
|
### New features
|
75
90
|
|
76
|
-
* [#60](https://github.com/rubocop
|
91
|
+
* [#60](https://github.com/rubocop/rubocop-minitest/issues/60): Add new cop `Minitest/GlobalExpectations` to check for deprecated global expectations. ([@tejasbubane][])
|
77
92
|
|
78
93
|
### Bug fixes
|
79
94
|
|
80
|
-
* [#58](https://github.com/rubocop
|
81
|
-
* [#59](https://github.com/rubocop
|
82
|
-
* [#61](https://github.com/rubocop
|
83
|
-
* [#62](https://github.com/rubocop
|
95
|
+
* [#58](https://github.com/rubocop/rubocop-minitest/pull/58): Fix a false negative for `Minitest/AssertMatch` and `Minitest/RefuteMatch` when an argument is enclosed in redundant parentheses. ([@koic][])
|
96
|
+
* [#59](https://github.com/rubocop/rubocop-minitest/pull/59): Fix a false negative for `Minitest/AssertRespondTo` and `Minitest/RefuteRespondTo` when an argument is enclosed in redundant parentheses. ([@koic][])
|
97
|
+
* [#61](https://github.com/rubocop/rubocop-minitest/pull/61): Fix a false negative for `Minitest/AssertInstanceOf` and `Minitest/RefuteInstanceOf` when an argument is enclosed in redundant parentheses. ([@koic][])
|
98
|
+
* [#62](https://github.com/rubocop/rubocop-minitest/pull/62): Fix a false negative for `Minitest/AssertEmpty` and `Minitest/RefuteEmpty` when an argument is enclosed in redundant parentheses. ([@koic][])
|
84
99
|
|
85
100
|
## 0.6.2 (2020-02-19)
|
86
101
|
|
87
102
|
### Bug fixes
|
88
103
|
|
89
|
-
* [#55](https://github.com/rubocop
|
104
|
+
* [#55](https://github.com/rubocop/rubocop-minitest/issues/55): Fix an error for `Minitest/AssertIncludes` when using local variable argument. ([@koic][])
|
90
105
|
|
91
106
|
## 0.6.1 (2020-02-18)
|
92
107
|
|
93
108
|
### Bug fixes
|
94
109
|
|
95
|
-
* [#52](https://github.com/rubocop
|
96
|
-
* [#52](https://github.com/rubocop
|
110
|
+
* [#52](https://github.com/rubocop/rubocop-minitest/issues/52): Make `Minitest/RefuteFalse` cop aware of `assert(!test)`. ([@koic][])
|
111
|
+
* [#52](https://github.com/rubocop/rubocop-minitest/issues/52): Fix a false negative for `Minitest/AssertIncludes` and `Minitest/RefuteIncludes` when an argument is enclosed in redundant parentheses. ([@koic][])
|
97
112
|
|
98
113
|
## 0.6.0 (2020-02-07)
|
99
114
|
|
100
115
|
### New features
|
101
116
|
|
102
|
-
* [#49](https://github.com/rubocop
|
117
|
+
* [#49](https://github.com/rubocop/rubocop-minitest/pull/49): New cops `AssertMatch` and `RefuteMatch` check for use of `assert_match`/`refute_match` instead of `assert(foo.match(bar))`/`refute(foo.match(bar))`. ([@fsateler][])
|
103
118
|
|
104
119
|
## 0.5.1 (2019-12-25)
|
105
120
|
|
106
121
|
### Bug fixes
|
107
122
|
|
108
|
-
* [#42](https://github.com/rubocop
|
123
|
+
* [#42](https://github.com/rubocop/rubocop-minitest/issues/42): Fix an incorrect autocorrect for some cops of `Minitest` department when using heredoc message. ([@koic][])
|
109
124
|
|
110
125
|
## 0.5.0 (2019-11-24)
|
111
126
|
|
112
127
|
### New features
|
113
128
|
|
114
|
-
* [#32](https://github.com/rubocop
|
129
|
+
* [#32](https://github.com/rubocop/rubocop-minitest/issues/32): Add new `Minitest/AssertEmptyLiteral` cop. ([@tejasbubane][])
|
115
130
|
|
116
131
|
## 0.4.1 (2019-11-10)
|
117
132
|
|
118
133
|
### Bug fixes
|
119
134
|
|
120
|
-
* [#39](https://github.com/rubocop
|
135
|
+
* [#39](https://github.com/rubocop/rubocop-minitest/issues/39): Fix an incorrect autocorrect for `Minitest/AssertRespondTo` and `Minitest/RefuteRespondTo` when using assertion method calling `respond_to` with receiver omitted. ([@koic][])
|
121
136
|
|
122
137
|
## 0.4.0 (2019-11-07)
|
123
138
|
|
124
139
|
### New features
|
125
140
|
|
126
|
-
* [#29](https://github.com/rubocop
|
127
|
-
* [#31](https://github.com/rubocop
|
128
|
-
* [#34](https://github.com/rubocop
|
129
|
-
* [#35](https://github.com/rubocop
|
141
|
+
* [#29](https://github.com/rubocop/rubocop-minitest/pull/29): Add new `Minitest/RefuteRespondTo` cop. ([@herwinw][])
|
142
|
+
* [#31](https://github.com/rubocop/rubocop-minitest/pull/31): Add new `Minitest/AssertEqual` cop. ([@herwinw][])
|
143
|
+
* [#34](https://github.com/rubocop/rubocop-minitest/pull/34): Add new `Minitest/AssertInstanceOf` cop. ([@abhaynikam][])
|
144
|
+
* [#35](https://github.com/rubocop/rubocop-minitest/pull/35): Add new `Minitest/RefuteInstanceOf` cop. ([@abhaynikam][])
|
130
145
|
|
131
146
|
### Bug fixes
|
132
147
|
|
133
|
-
* [#25](https://github.com/rubocop
|
148
|
+
* [#25](https://github.com/rubocop/rubocop-minitest/issues/25): Add `Enabled: true` to `Minitest` department config to suppress `Warning: Minitest does not support Enabled parameter`. ([@koic][])
|
134
149
|
|
135
150
|
## 0.3.0 (2019-10-13)
|
136
151
|
|
137
152
|
### New features
|
138
153
|
|
139
|
-
* [#15](https://github.com/rubocop
|
140
|
-
* [#18](https://github.com/rubocop
|
141
|
-
* [#20](https://github.com/rubocop
|
142
|
-
* [#21](https://github.com/rubocop
|
143
|
-
* [#27](https://github.com/rubocop
|
154
|
+
* [#15](https://github.com/rubocop/rubocop-minitest/pull/15): Add new `Minitest/RefuteIncludes` cop. ([@abhaynikam][])
|
155
|
+
* [#18](https://github.com/rubocop/rubocop-minitest/pull/18): Add new `Minitest/RefuteFalse` cop. ([@duduribeiro][])
|
156
|
+
* [#20](https://github.com/rubocop/rubocop-minitest/pull/20): Add new `Minitest/RefuteEmpty` cop. ([@abhaynikam][])
|
157
|
+
* [#21](https://github.com/rubocop/rubocop-minitest/pull/21): Add new `Minitest/RefuteEqual` cop. ([@duduribeiro][])
|
158
|
+
* [#27](https://github.com/rubocop/rubocop-minitest/pull/27): Add new `Minitest/AssertRespondTo` cop. ([@duduribeiro][])
|
144
159
|
|
145
160
|
### Bug fixes
|
146
161
|
|
147
|
-
* [#19](https://github.com/rubocop
|
162
|
+
* [#19](https://github.com/rubocop/rubocop-minitest/pull/19): Fix a false negative for `Minitest/AssertIncludes` when using `include` method in arguments of `assert` method. ([@abhaynikam][])
|
148
163
|
|
149
164
|
## 0.2.1 (2019-09-24)
|
150
165
|
|
151
166
|
### Bug fixes
|
152
167
|
|
153
|
-
* [#13](https://github.com/rubocop
|
168
|
+
* [#13](https://github.com/rubocop/rubocop-minitest/issues/13): Fix the execution target specified in `Include` parameter. ([@koic][])
|
154
169
|
|
155
170
|
## 0.2.0 (2019-09-21)
|
156
171
|
|
157
172
|
### New features
|
158
173
|
|
159
|
-
* [#11](https://github.com/rubocop
|
160
|
-
* [#8](https://github.com/rubocop
|
161
|
-
* [#9](https://github.com/rubocop
|
162
|
-
* [#10](https://github.com/rubocop
|
174
|
+
* [#11](https://github.com/rubocop/rubocop-minitest/pull/11): Add new `Minitest/RefuteNil` cop. ([@tejasbubane][])
|
175
|
+
* [#8](https://github.com/rubocop/rubocop-minitest/pull/8): Add new `Minitest/AssertTruthy` cop. ([@abhaynikam][])
|
176
|
+
* [#9](https://github.com/rubocop/rubocop-minitest/pull/9): Add new `Minitest/AssertIncludes` cop. ([@abhaynikam][])
|
177
|
+
* [#10](https://github.com/rubocop/rubocop-minitest/pull/10): Add new `Minitest/AssertEmpty` cop. ([@abhaynikam][])
|
163
178
|
|
164
179
|
## 0.1.0 (2019-09-01)
|
165
180
|
|
166
181
|
### New features
|
167
182
|
|
168
183
|
* Create RuboCop Minitest gem. ([@koic][])
|
169
|
-
* [#6](https://github.com/rubocop
|
184
|
+
* [#6](https://github.com/rubocop/rubocop-minitest/pull/6): Add new `Minitest/AssertNil` cop. ([@duduribeiro][])
|
170
185
|
|
171
186
|
[@koic]: https://github.com/koic
|
172
187
|
[@duduribeiro]: https://github.com/duduribeiro
|
@@ -177,3 +192,5 @@
|
|
177
192
|
[@andrykonchin]: https://github.com/andrykonchin
|
178
193
|
[@fatkodima]: https://github.com/fatkodima
|
179
194
|
[@tsmmark]: https://github.com/tsmmark
|
195
|
+
[@cstyles]: https://github.com/cstyles
|
196
|
+
[@ghiculescu]: https://github.com/ghiculescu
|
data/CONTRIBUTING.md
CHANGED
@@ -49,18 +49,18 @@ $ rubocop -V
|
|
49
49
|
Here are a few examples:
|
50
50
|
|
51
51
|
```
|
52
|
-
* [#716](https://github.com/rubocop
|
52
|
+
* [#716](https://github.com/rubocop/rubocop-minitest/issues/716): Fixed a regression in the auto-correction logic of `MethodDefParentheses`. ([@bbatsov][])
|
53
53
|
* New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
|
54
54
|
```
|
55
55
|
|
56
56
|
* Mark it up in [Markdown syntax][6].
|
57
57
|
* The entry line should start with `* ` (an asterisk and a space).
|
58
|
-
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/rubocop
|
58
|
+
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/rubocop/rubocop-minitest/issues/123): `.
|
59
59
|
* Describe the brief of the change. The sentence should end with a punctuation.
|
60
60
|
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
61
61
|
* If this is your first contribution to RuboCop project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
|
62
62
|
|
63
|
-
[1]: https://github.com/rubocop
|
63
|
+
[1]: https://github.com/rubocop/rubocop-minitest/issues
|
64
64
|
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
|
65
65
|
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
66
66
|
[4]: https://help.github.com/articles/about-pull-requests
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# RuboCop Minitest
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rubocop-minitest.svg)](https://badge.fury.io/rb/rubocop-minitest)
|
4
|
-
[![CircleCI](https://circleci.com/gh/rubocop
|
4
|
+
[![CircleCI](https://circleci.com/gh/rubocop/rubocop-minitest.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop-minitest)
|
5
5
|
|
6
|
-
A [RuboCop](https://github.com/rubocop
|
6
|
+
A [RuboCop](https://github.com/rubocop/rubocop) extension focused on enforcing Minitest best practices and coding conventions.
|
7
7
|
The library is based on the guidelines outlined in the community [Minitest Style Guide](https://minitest.rubystyle.guide).
|
8
8
|
|
9
9
|
## Installation
|
@@ -81,14 +81,14 @@ You can read a lot more about RuboCop Minitest in its [official docs](https://do
|
|
81
81
|
|
82
82
|
If you use RuboCop Minitest in your project, you can include one of these badges in your readme to let people know that your code is written following the community Minitest Style Guide.
|
83
83
|
|
84
|
-
[![Minitest Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop
|
84
|
+
[![Minitest Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop-minitest)
|
85
85
|
|
86
86
|
[![Minitest Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://minitest.rubystyle.guide)
|
87
87
|
|
88
88
|
Here are the Markdown snippets for the two badges:
|
89
89
|
|
90
90
|
``` markdown
|
91
|
-
[![Minitest Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop
|
91
|
+
[![Minitest Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop-minitest)
|
92
92
|
|
93
93
|
[![Minitest Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://minitest.rubystyle.guide)
|
94
94
|
```
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/config/default.yml
CHANGED
@@ -15,7 +15,7 @@ Minitest/AssertEmptyLiteral:
|
|
15
15
|
Enabled: true
|
16
16
|
SafeAutoCorrect: false
|
17
17
|
VersionAdded: '0.5'
|
18
|
-
VersionChanged: '0.
|
18
|
+
VersionChanged: '0.11'
|
19
19
|
|
20
20
|
Minitest/AssertEqual:
|
21
21
|
Description: 'This cop enforces the test to use `assert_equal` instead of using `assert(expected == actual)`.'
|
@@ -54,7 +54,7 @@ Minitest/AssertInstanceOf:
|
|
54
54
|
|
55
55
|
Minitest/AssertKindOf:
|
56
56
|
Description: 'This cop enforces the test to use `assert_kind_of(Class, object)` over `assert(object.kind_of?(Class))`'
|
57
|
-
StyleGuide: 'https://github.com/rubocop
|
57
|
+
StyleGuide: 'https://github.com/rubocop/minitest-style-guide#assert-kind-of'
|
58
58
|
Enabled: 'pending'
|
59
59
|
VersionAdded: '0.10'
|
60
60
|
|
@@ -84,7 +84,7 @@ Minitest/AssertRespondTo:
|
|
84
84
|
|
85
85
|
Minitest/AssertSilent:
|
86
86
|
Description: "This cop enforces the test to use `assert_silent { ... }` instead of using `assert_output('', '') { ... }`."
|
87
|
-
StyleGuide: 'https://github.com/rubocop
|
87
|
+
StyleGuide: 'https://github.com/rubocop/minitest-style-guide#assert-silent'
|
88
88
|
Enabled: 'pending'
|
89
89
|
VersionAdded: '0.10'
|
90
90
|
|
@@ -94,6 +94,11 @@ Minitest/AssertTruthy:
|
|
94
94
|
Enabled: true
|
95
95
|
VersionAdded: '0.2'
|
96
96
|
|
97
|
+
Minitest/AssertWithExpectedArgument:
|
98
|
+
Description: 'This cop tries to detect when a user accidentally used `assert` when they meant to use `assert_equal`.'
|
99
|
+
Enabled: pending
|
100
|
+
VersionAdded: '0.11'
|
101
|
+
|
97
102
|
Minitest/GlobalExpectations:
|
98
103
|
Description: 'This cop checks for deprecated global expectations.'
|
99
104
|
StyleGuide: 'https://minitest.rubystyle.guide#global-expectations'
|
@@ -156,7 +161,7 @@ Minitest/RefuteInstanceOf:
|
|
156
161
|
|
157
162
|
Minitest/RefuteKindOf:
|
158
163
|
Description: 'This cop enforces the test to use `refute_kind_of(Class, object)` over `refute(object.kind_of?(Class))`.'
|
159
|
-
StyleGuide: 'https://github.com/rubocop
|
164
|
+
StyleGuide: 'https://github.com/rubocop/minitest-style-guide#refute-kind-of'
|
160
165
|
Enabled: 'pending'
|
161
166
|
VersionAdded: '0.10'
|
162
167
|
|
data/docs/antora.yml
CHANGED
@@ -27,6 +27,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
|
|
27
27
|
* xref:cops_minitest.adoc#minitestassertrespondto[Minitest/AssertRespondTo]
|
28
28
|
* xref:cops_minitest.adoc#minitestassertsilent[Minitest/AssertSilent]
|
29
29
|
* xref:cops_minitest.adoc#minitestasserttruthy[Minitest/AssertTruthy]
|
30
|
+
* xref:cops_minitest.adoc#minitestassertwithexpectedargument[Minitest/AssertWithExpectedArgument]
|
30
31
|
* xref:cops_minitest.adoc#minitestassertioninlifecyclehook[Minitest/AssertionInLifecycleHook]
|
31
32
|
* xref:cops_minitest.adoc#minitestglobalexpectations[Minitest/GlobalExpectations]
|
32
33
|
* xref:cops_minitest.adoc#minitestliteralasactualargument[Minitest/LiteralAsActualArgument]
|
@@ -41,19 +41,19 @@ assert_empty(object, 'message')
|
|
41
41
|
| Yes
|
42
42
|
| Yes (Unsafe)
|
43
43
|
| 0.5
|
44
|
-
| 0.
|
44
|
+
| 0.11
|
45
45
|
|===
|
46
46
|
|
47
47
|
This cop enforces the test to use `assert_empty`
|
48
|
-
instead of using `
|
48
|
+
instead of using `assert_equal([], object)`.
|
49
49
|
|
50
50
|
=== Examples
|
51
51
|
|
52
52
|
[source,ruby]
|
53
53
|
----
|
54
54
|
# bad
|
55
|
-
|
56
|
-
|
55
|
+
assert_equal([], object)
|
56
|
+
assert_equal({}, object)
|
57
57
|
|
58
58
|
# good
|
59
59
|
assert_empty(object)
|
@@ -215,7 +215,7 @@ assert_kind_of(Class, object, 'message')
|
|
215
215
|
|
216
216
|
=== References
|
217
217
|
|
218
|
-
* https://github.com/rubocop
|
218
|
+
* https://github.com/rubocop/minitest-style-guide#assert-kind-of
|
219
219
|
|
220
220
|
== Minitest/AssertMatch
|
221
221
|
|
@@ -407,7 +407,7 @@ assert_silent { puts object.do_something }
|
|
407
407
|
|
408
408
|
=== References
|
409
409
|
|
410
|
-
* https://github.com/rubocop
|
410
|
+
* https://github.com/rubocop/minitest-style-guide#assert-silent
|
411
411
|
|
412
412
|
== Minitest/AssertTruthy
|
413
413
|
|
@@ -441,6 +441,35 @@ assert(actual, 'message')
|
|
441
441
|
|
442
442
|
* https://minitest.rubystyle.guide#assert-truthy
|
443
443
|
|
444
|
+
== Minitest/AssertWithExpectedArgument
|
445
|
+
|
446
|
+
|===
|
447
|
+
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
|
448
|
+
|
449
|
+
| Pending
|
450
|
+
| Yes
|
451
|
+
| No
|
452
|
+
| 0.11
|
453
|
+
| -
|
454
|
+
|===
|
455
|
+
|
456
|
+
This cop tries to detect when a user accidentally used
|
457
|
+
`assert` when they meant to use `assert_equal`.
|
458
|
+
|
459
|
+
=== Examples
|
460
|
+
|
461
|
+
[source,ruby]
|
462
|
+
----
|
463
|
+
# bad
|
464
|
+
assert(3, my_list.length)
|
465
|
+
assert(expected, actual)
|
466
|
+
|
467
|
+
# good
|
468
|
+
assert_equal(3, my_list.length)
|
469
|
+
assert_equal(expected, actual)
|
470
|
+
assert(foo, 'message')
|
471
|
+
----
|
472
|
+
|
444
473
|
== Minitest/AssertionInLifecycleHook
|
445
474
|
|
446
475
|
|===
|
@@ -817,7 +846,7 @@ refute_kind_of(Class, object, 'message')
|
|
817
846
|
|
818
847
|
=== References
|
819
848
|
|
820
|
-
* https://github.com/rubocop
|
849
|
+
* https://github.com/rubocop/minitest-style-guide#refute-kind-of
|
821
850
|
|
822
851
|
== Minitest/RefuteMatch
|
823
852
|
|