rubocop-minitest 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -0
- data/CHANGELOG.md +7 -1
- data/LICENSE.txt +1 -1
- data/docs/modules/ROOT/pages/cops_minitest.adoc +7 -0
- data/lib/rubocop/cop/minitest/test_method_name.rb +10 -1
- data/lib/rubocop/cop/mixin/minitest_exploration_helpers.rb +13 -0
- data/lib/rubocop/minitest/version.rb +1 -1
- data/mkdocs.yml +1 -1
- data/relnotes/v0.10.3.md +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578c35f660ca4c19f2a5d9864cb79eb0092923999c6d4e36ced55680ea7c0789
|
4
|
+
data.tar.gz: 1ba667604ca929938ac8a13754728eb879bb7e6fe09d48475779bc8a2c05c2b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1328f2b45769ce5020394625744839ab2658442c0c1e14dc07a98bd26826064c623b5ba0106b93a2ba40a4b6052110b84233d3ea9ff71c5334fd790bdc107965
|
7
|
+
data.tar.gz: 8d815f7813ce9dd261ad72dbf39a741456a504a04d1dd01f986ad96ad3da26d1c095541ac0a8b6eeaadb4945a02321664bdf9e70e02c028a4dfbe70c354d40db
|
data/.circleci/config.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,17 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.10.3 (2021-01-12)
|
6
|
+
|
7
|
+
### Bug fixes
|
8
|
+
|
9
|
+
* [#115](https://github.com/rubocop-hq/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
|
+
|
5
11
|
## 0.10.2 (2020-12-27)
|
6
12
|
|
7
13
|
### Bug fixes
|
8
14
|
|
9
|
-
* [#113](https://github.com/rubocop-hq/rubocop-minitest/issues/113):
|
15
|
+
* [#113](https://github.com/rubocop-hq/rubocop-minitest/issues/113): Fix an error for `Minitest/AssertEqual` and some cops when using `assert` with block argument. ([@koic][])
|
10
16
|
|
11
17
|
## 0.10.1 (2020-07-25)
|
12
18
|
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019-
|
3
|
+
Copyright (c) 2019-2021 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -962,6 +962,7 @@ refute_respond_to(self, :do_something)
|
|
962
962
|
|===
|
963
963
|
|
964
964
|
This cop enforces that test method names start with `test_` prefix.
|
965
|
+
It aims to prevent tests that aren't executed by forgetting to start test method name with `test_`.
|
965
966
|
|
966
967
|
=== Examples
|
967
968
|
|
@@ -980,6 +981,12 @@ class FooTest < Minitest::Test
|
|
980
981
|
assert_equal 42, do_something
|
981
982
|
end
|
982
983
|
end
|
984
|
+
|
985
|
+
# good
|
986
|
+
class FooTest < Minitest::Test
|
987
|
+
def helper_method(argument)
|
988
|
+
end
|
989
|
+
end
|
983
990
|
----
|
984
991
|
|
985
992
|
== Minitest/UnspecifiedException
|
@@ -4,6 +4,7 @@ module RuboCop
|
|
4
4
|
module Cop
|
5
5
|
module Minitest
|
6
6
|
# This cop enforces that test method names start with `test_` prefix.
|
7
|
+
# It aims to prevent tests that aren't executed by forgetting to start test method name with `test_`.
|
7
8
|
#
|
8
9
|
# @example
|
9
10
|
# # bad
|
@@ -20,6 +21,12 @@ module RuboCop
|
|
20
21
|
# end
|
21
22
|
# end
|
22
23
|
#
|
24
|
+
# # good
|
25
|
+
# class FooTest < Minitest::Test
|
26
|
+
# def helper_method(argument)
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
#
|
23
30
|
class TestMethodName < Cop
|
24
31
|
include MinitestExplorationHelpers
|
25
32
|
include DefNode
|
@@ -54,7 +61,9 @@ module RuboCop
|
|
54
61
|
end
|
55
62
|
|
56
63
|
def offense?(node)
|
57
|
-
|
64
|
+
return false if node.each_child_node(:send).none? { |send_node| assertion_method?(send_node.method_name) }
|
65
|
+
|
66
|
+
public?(node) && node.arguments.empty? && !test_method_name?(node) && !lifecycle_hook_method?(node)
|
58
67
|
end
|
59
68
|
|
60
69
|
def public?(node)
|
@@ -10,6 +10,15 @@ module RuboCop
|
|
10
10
|
|
11
11
|
ASSERTION_PREFIXES = %w[assert refute].freeze
|
12
12
|
|
13
|
+
ASSERTION_METHODS = %i[
|
14
|
+
assert assert_empty assert_equal assert_in_delta assert_in_epsilon assert_includes assert_instance_of
|
15
|
+
assert_kind_of assert_match assert_nil assert_operator assert_output assert_path_exists assert_predicate
|
16
|
+
assert_raises assert_respond_to assert_same assert_send assert_silent assert_throws
|
17
|
+
refute refute_empty refute_equal refute_in_delta refute_in_epsilon refute_includes refute_instance_of
|
18
|
+
refute_kind_of refute_match refute_nil refute_operator refute_path_exists refute_predicate
|
19
|
+
refute_respond_to refute_same
|
20
|
+
].freeze
|
21
|
+
|
13
22
|
LIFECYCLE_HOOK_METHODS = %i[
|
14
23
|
before_setup
|
15
24
|
setup
|
@@ -76,6 +85,10 @@ module RuboCop
|
|
76
85
|
ASSERTION_PREFIXES.any? { |prefix| node.method_name.to_s.start_with?(prefix) }
|
77
86
|
end
|
78
87
|
|
88
|
+
def assertion_method?(method_name)
|
89
|
+
ASSERTION_METHODS.include?(method_name)
|
90
|
+
end
|
91
|
+
|
79
92
|
def lifecycle_hook_method?(node)
|
80
93
|
node.def_type? && LIFECYCLE_HOOK_METHODS.include?(node.method_name)
|
81
94
|
end
|
data/mkdocs.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
site_name: "A RuboCop extension focused on enforcing Minitest best practices and coding conventions."
|
2
2
|
repo_url: https://github.com/rubocop-hq/rubocop-minitest
|
3
3
|
edit_uri: edit/master/legacy-docs/
|
4
|
-
copyright: "Copyright ©
|
4
|
+
copyright: "Copyright © 2021 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO, and RuboCop contributors"
|
5
5
|
docs_dir: legacy-docs
|
6
6
|
pages:
|
7
7
|
- Home: index.md
|
data/relnotes/v0.10.3.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
### Bug fixes
|
2
|
+
|
3
|
+
* [#115](https://github.com/rubocop-hq/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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-01-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- relnotes/v0.10.0.md
|
132
132
|
- relnotes/v0.10.1.md
|
133
133
|
- relnotes/v0.10.2.md
|
134
|
+
- relnotes/v0.10.3.md
|
134
135
|
- relnotes/v0.2.0.md
|
135
136
|
- relnotes/v0.2.1.md
|
136
137
|
- relnotes/v0.3.0.md
|
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
173
|
- !ruby/object:Gem::Version
|
173
174
|
version: '0'
|
174
175
|
requirements: []
|
175
|
-
rubygems_version: 3.2.
|
176
|
+
rubygems_version: 3.2.4
|
176
177
|
signing_key:
|
177
178
|
specification_version: 4
|
178
179
|
summary: Automatic Minitest code style checking tool.
|