rubocop-minitest 0.24.0 → 0.25.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c318725a3a6fe8afca027a338421a451831204768bfbd0a36ad80beb28d64c2
|
4
|
+
data.tar.gz: cd62f5d9c99d4451f12ab079e5593da29d4a5e154d7654c36df4cc65e2b9d618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93c50c17543b7618acfb1b78566d0be02b476469a32b74855b8393917286695ff0414975b71ede3c749bf7d2191550a3ae2cdb4a98cd481bfd528d510b2eca2
|
7
|
+
data.tar.gz: c2b106af9e68a77ace2c9eb44a49fbf2afea7d854cd3985c0d845dfa16ab39e9dcd50700d1e16f093d44014444a1946fe34641988033bab4988361c5e7ea06ed
|
@@ -6,6 +6,9 @@ module RuboCop
|
|
6
6
|
# Tries to detect when a user accidentally used
|
7
7
|
# `assert` when they meant to use `assert_equal`.
|
8
8
|
#
|
9
|
+
# NOTE: The second argument to the `assert` method named `message` and `msg` is allowed.
|
10
|
+
# Because their names are inferred as message arguments.
|
11
|
+
#
|
9
12
|
# @safety
|
10
13
|
# This cop is unsafe because it is not possible to determine
|
11
14
|
# whether the second argument of `assert` is a message or not.
|
@@ -19,10 +22,13 @@ module RuboCop
|
|
19
22
|
# assert_equal(3, my_list.length)
|
20
23
|
# assert_equal(expected, actual)
|
21
24
|
# assert(foo, 'message')
|
25
|
+
# assert(foo, message)
|
26
|
+
# assert(foo, msg)
|
22
27
|
#
|
23
28
|
class AssertWithExpectedArgument < Base
|
24
29
|
MSG = 'Did you mean to use `assert_equal(%<arguments>s)`?'
|
25
30
|
RESTRICT_ON_SEND = %i[assert].freeze
|
31
|
+
MESSAGE_VARIABLES = %w[message msg].freeze
|
26
32
|
|
27
33
|
def_node_matcher :assert_with_two_arguments?, <<~PATTERN
|
28
34
|
(send nil? :assert $_ $_)
|
@@ -30,7 +36,7 @@ module RuboCop
|
|
30
36
|
|
31
37
|
def on_send(node)
|
32
38
|
assert_with_two_arguments?(node) do |_expected, message|
|
33
|
-
return if message.str_type? || message.dstr_type?
|
39
|
+
return if message.str_type? || message.dstr_type? || MESSAGE_VARIABLES.include?(message.source)
|
34
40
|
|
35
41
|
arguments = node.arguments.map(&:source).join(', ')
|
36
42
|
add_offense(node, message: format(MSG, arguments: arguments))
|
@@ -38,7 +38,7 @@ module RuboCop
|
|
38
38
|
|
39
39
|
# Support Active Support's `test 'example' { ... }` method.
|
40
40
|
# https://api.rubyonrails.org/classes/ActiveSupport/Testing/Declarative.html
|
41
|
-
test_blocks = class_node.each_descendant(:block).select { |
|
41
|
+
test_blocks = class_node.each_descendant(:block).select { |block| block.method?(:test) || block.method?(:it) }
|
42
42
|
|
43
43
|
test_cases + test_blocks
|
44
44
|
end
|
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.
|
4
|
+
version: 0.25.1
|
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: 2022-
|
13
|
+
date: 2022-12-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -120,7 +120,7 @@ metadata:
|
|
120
120
|
homepage_uri: https://docs.rubocop.org/rubocop-minitest/
|
121
121
|
changelog_uri: https://github.com/rubocop/rubocop-minitest/blob/master/CHANGELOG.md
|
122
122
|
source_code_uri: https://github.com/rubocop/rubocop-minitest
|
123
|
-
documentation_uri: https://docs.rubocop.org/rubocop-minitest/0.
|
123
|
+
documentation_uri: https://docs.rubocop.org/rubocop-minitest/0.25
|
124
124
|
bug_tracker_uri: https://github.com/rubocop/rubocop-minitest/issues
|
125
125
|
rubygems_mfa_required: 'true'
|
126
126
|
post_install_message:
|