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: b0a695c307538885f790b2efe35af28113a4f76baf8ba870ae41d870a54b31fe
4
- data.tar.gz: 40f94eb2dfa3d962e9ffba5dc989d281ae74f81ec3cbfac442e15095ac3d612c
3
+ metadata.gz: 5c318725a3a6fe8afca027a338421a451831204768bfbd0a36ad80beb28d64c2
4
+ data.tar.gz: cd62f5d9c99d4451f12ab079e5593da29d4a5e154d7654c36df4cc65e2b9d618
5
5
  SHA512:
6
- metadata.gz: 04c9af1d29a613536c03c372fac160ad7df0d32e68354f765bfbb178dfcca27b670da7f55bce7923dbbc048c227346f9656b31b8f641ba07254a7bf61c2a6d10
7
- data.tar.gz: 9e3c8090307fa86ba39e2b917e583815616e4ae82bbb32d36cadcaa7f1eca3ca293d8907b71bfaa3bebf9e643fd5380040983802f624094a4f1776794c98b838
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 { |block_node| block_node.method?(:test) }
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
@@ -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.24.0'
7
+ STRING = '0.25.1'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
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.24.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-11-27 00:00:00.000000000 Z
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.24
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: