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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ad49b7b1f0f0d916cb20400f58ea616d13663e99a57719d9b4a8a373a859a5d
4
- data.tar.gz: c69990256d72a503f7bf072273fe077f7c2eea32fd6c7f13b2f2fe83f18c8780
3
+ metadata.gz: 578c35f660ca4c19f2a5d9864cb79eb0092923999c6d4e36ced55680ea7c0789
4
+ data.tar.gz: 1ba667604ca929938ac8a13754728eb879bb7e6fe09d48475779bc8a2c05c2b0
5
5
  SHA512:
6
- metadata.gz: c6899f78263d3d2728d5f0074d36c6813b8392d910524193f871ef1313af59fc78270ddb7ffa8b5b11c83c6c6f9bc6f0a8e57203dd54ffb3d81f1b036b025913
7
- data.tar.gz: c402e470711d7432317c48c19c64e3b27c701855ceea1557abcf8418e6dd5ecfa33b0433372f9a73fa58ab956989aed7fbdb6b8f227e16b32272d9813d29c5d3
6
+ metadata.gz: 1328f2b45769ce5020394625744839ab2658442c0c1e14dc07a98bd26826064c623b5ba0106b93a2ba40a4b6052110b84233d3ea9ff71c5334fd790bdc107965
7
+ data.tar.gz: 8d815f7813ce9dd261ad72dbf39a741456a504a04d1dd01f986ad96ad3da26d1c095541ac0a8b6eeaadb4945a02321664bdf9e70e02c028a4dfbe70c354d40db
@@ -50,6 +50,9 @@ workflows:
50
50
  - rake_default:
51
51
  name: Ruby 2.7
52
52
  image: circleci/ruby:2.7
53
+ - rake_default:
54
+ name: Ruby 3.0
55
+ image: circleci/ruby:3.0
53
56
  - rake_default:
54
57
  name: Ruby HEAD
55
58
  image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
@@ -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): This PR fixes an error for `Minitest/AssertEqual` and some cops when using `assert` with block argument. ([@koic][])
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
 
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2020 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO
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
- public?(node) && !test_method_name?(node) && !lifecycle_hook_method?(node)
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
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Minitest
5
5
  # This module holds the RuboCop Minitest version information.
6
6
  module Version
7
- STRING = '0.10.2'
7
+ STRING = '0.10.3'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
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 &copy; 2019 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO, and RuboCop contributors"
4
+ copyright: "Copyright &copy; 2021 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO, and RuboCop contributors"
5
5
  docs_dir: legacy-docs
6
6
  pages:
7
7
  - Home: index.md
@@ -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.2
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: 2020-12-27 00:00:00.000000000 Z
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.3
176
+ rubygems_version: 3.2.4
176
177
  signing_key:
177
178
  specification_version: 4
178
179
  summary: Automatic Minitest code style checking tool.