rubocop-minitest 0.19.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -3
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +1 -1
  4. data/.github/workflows/spell_checking.yml +1 -1
  5. data/.rubocop.yml +6 -1
  6. data/CHANGELOG.md +32 -4
  7. data/CONTRIBUTING.md +1 -1
  8. data/Gemfile +1 -1
  9. data/config/default.yml +6 -0
  10. data/docs/antora.yml +1 -1
  11. data/docs/modules/ROOT/pages/cops.adoc +1 -0
  12. data/docs/modules/ROOT/pages/cops_minitest.adoc +126 -55
  13. data/lib/rubocop/cop/minitest/assert_empty.rb +1 -2
  14. data/lib/rubocop/cop/minitest/assert_empty_literal.rb +1 -1
  15. data/lib/rubocop/cop/minitest/assert_equal.rb +1 -1
  16. data/lib/rubocop/cop/minitest/assert_in_delta.rb +1 -1
  17. data/lib/rubocop/cop/minitest/assert_includes.rb +1 -1
  18. data/lib/rubocop/cop/minitest/assert_instance_of.rb +1 -1
  19. data/lib/rubocop/cop/minitest/assert_kind_of.rb +1 -1
  20. data/lib/rubocop/cop/minitest/assert_match.rb +1 -1
  21. data/lib/rubocop/cop/minitest/assert_nil.rb +1 -1
  22. data/lib/rubocop/cop/minitest/assert_output.rb +1 -1
  23. data/lib/rubocop/cop/minitest/assert_path_exists.rb +1 -2
  24. data/lib/rubocop/cop/minitest/assert_predicate.rb +1 -1
  25. data/lib/rubocop/cop/minitest/assert_respond_to.rb +1 -1
  26. data/lib/rubocop/cop/minitest/assert_silent.rb +1 -1
  27. data/lib/rubocop/cop/minitest/assert_truthy.rb +1 -2
  28. data/lib/rubocop/cop/minitest/assert_with_expected_argument.rb +1 -1
  29. data/lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb +1 -1
  30. data/lib/rubocop/cop/minitest/duplicate_test_run.rb +5 -2
  31. data/lib/rubocop/cop/minitest/global_expectations.rb +13 -13
  32. data/lib/rubocop/cop/minitest/literal_as_actual_argument.rb +1 -1
  33. data/lib/rubocop/cop/minitest/multiple_assertions.rb +1 -1
  34. data/lib/rubocop/cop/minitest/no_assertions.rb +1 -1
  35. data/lib/rubocop/cop/minitest/refute_empty.rb +1 -2
  36. data/lib/rubocop/cop/minitest/refute_equal.rb +1 -1
  37. data/lib/rubocop/cop/minitest/refute_false.rb +1 -2
  38. data/lib/rubocop/cop/minitest/refute_in_delta.rb +1 -1
  39. data/lib/rubocop/cop/minitest/refute_includes.rb +1 -1
  40. data/lib/rubocop/cop/minitest/refute_instance_of.rb +1 -1
  41. data/lib/rubocop/cop/minitest/refute_kind_of.rb +1 -1
  42. data/lib/rubocop/cop/minitest/refute_match.rb +1 -1
  43. data/lib/rubocop/cop/minitest/refute_nil.rb +1 -1
  44. data/lib/rubocop/cop/minitest/refute_path_exists.rb +1 -2
  45. data/lib/rubocop/cop/minitest/refute_predicate.rb +1 -1
  46. data/lib/rubocop/cop/minitest/refute_respond_to.rb +1 -1
  47. data/lib/rubocop/cop/minitest/skip_ensure.rb +95 -0
  48. data/lib/rubocop/cop/minitest/test_method_name.rb +1 -1
  49. data/lib/rubocop/cop/minitest/unreachable_assertion.rb +1 -1
  50. data/lib/rubocop/cop/minitest/unspecified_exception.rb +1 -1
  51. data/lib/rubocop/cop/minitest_cops.rb +1 -0
  52. data/lib/rubocop/cop/mixin/minitest_cop_rule.rb +2 -2
  53. data/lib/rubocop/cop/mixin/predicate_assertion_handleable.rb +11 -2
  54. data/lib/rubocop/minitest/assert_offense.rb +3 -3
  55. data/lib/rubocop/minitest/version.rb +1 -1
  56. data/relnotes/v0.12.0.md +1 -1
  57. data/relnotes/v0.15.2.md +1 -1
  58. data/relnotes/v0.19.0.md +1 -1
  59. data/relnotes/v0.19.1.md +5 -0
  60. data/relnotes/v0.20.0.md +13 -0
  61. data/relnotes/v0.20.1.md +5 -0
  62. data/relnotes/v0.9.0.md +1 -1
  63. data/rubocop-minitest.gemspec +1 -1
  64. data/tasks/cut_release.rake +1 -1
  65. metadata +9 -5
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `assert_equal(expected, actual)`
6
+ # Enforces the use of `assert_equal(expected, actual)`
7
7
  # over `assert(expected == actual)`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_in_delta`
6
+ # Enforces the test to use `assert_in_delta`
7
7
  # instead of using `assert_equal` to compare floats.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_includes`
6
+ # Enforces the test to use `assert_includes`
7
7
  # instead of using `assert(collection.include?(object))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_instance_of(Class, object)`
6
+ # Enforces the test to use `assert_instance_of(Class, object)`
7
7
  # over `assert(object.instance_of?(Class))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_kind_of(Class, object)`
6
+ # Enforces the test to use `assert_kind_of(Class, object)`
7
7
  # over `assert(object.kind_of?(Class))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_match`
6
+ # Enforces the test to use `assert_match`
7
7
  # instead of using `assert(matcher.match(string))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_nil` instead of using
6
+ # Enforces the test to use `assert_nil` instead of using
7
7
  # `assert_equal(nil, something)`, `assert(something.nil?)`, or `assert_predicate(something, :nil?)`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks for opportunities to use `assert_output`.
6
+ # Checks for opportunities to use `assert_output`.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_path_exists`
7
- # instead of using `assert(File.exist?(path))`.
6
+ # Enforces the test to use `assert_path_exists` instead of using `assert(File.exist?(path))`.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_predicate`
6
+ # Enforces the test to use `assert_predicate`
7
7
  # instead of using `assert(obj.a_predicate_method?)`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `assert_respond_to(object, :do_something)`
6
+ # Enforces the use of `assert_respond_to(object, :do_something)`
7
7
  # over `assert(object.respond_to?(:do_something))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert_silent { ... }`
6
+ # Enforces the test to use `assert_silent { ... }`
7
7
  # instead of using `assert_output('', '') { ... }`.
8
8
  #
9
9
  # @example
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `assert(actual)`
7
- # instead of using `assert_equal(true, actual)`.
6
+ # Enforces the test to use `assert(actual)` instead of using `assert_equal(true, actual)`.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop tries to detect when a user accidentally used
6
+ # Tries to detect when a user accidentally used
7
7
  # `assert` when they meant to use `assert_equal`.
8
8
  #
9
9
  # @safety
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks for usage of assertions in lifecycle hooks.
6
+ # Checks for usage of assertions in lifecycle hooks.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -7,7 +7,7 @@ module RuboCop
7
7
  # it will also inherit its methods causing Minitest to run the parent's tests methods twice.
8
8
  #
9
9
  # This cop detects when there are two tests classes, one inherits from the other, and both have tests methods.
10
- # This cop will add an offence to the Child class in such a case.
10
+ # This cop will add an offense to the Child class in such a case.
11
11
  #
12
12
  # @example
13
13
  # # bad
@@ -63,7 +63,10 @@ module RuboCop
63
63
 
64
64
  def parent_class_has_test_methods?(class_node)
65
65
  parent_class = class_node.parent_class
66
- parent_class_node = class_node.parent.each_child_node(:class).detect do |klass|
66
+
67
+ return false unless (class_node_parent = class_node.parent)
68
+
69
+ parent_class_node = class_node_parent.each_child_node(:class).detect do |klass|
67
70
  klass.identifier == parent_class
68
71
  end
69
72
 
@@ -3,15 +3,20 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks for deprecated global expectations
6
+ # Checks for deprecated global expectations
7
7
  # and autocorrects them to use expect format.
8
8
  #
9
- # @example EnforcedStyle: _
9
+ # @example EnforcedStyle: any (default)
10
10
  # # bad
11
11
  # musts.must_equal expected_musts
12
12
  # wonts.wont_match expected_wonts
13
13
  # musts.must_raise TypeError
14
14
  #
15
+ # # good
16
+ # _(musts).must_equal expected_musts
17
+ # _(wonts).wont_match expected_wonts
18
+ # _ { musts }.must_raise TypeError
19
+ #
15
20
  # expect(musts).must_equal expected_musts
16
21
  # expect(wonts).wont_match expected_wonts
17
22
  # expect { musts }.must_raise TypeError
@@ -20,22 +25,12 @@ module RuboCop
20
25
  # value(wonts).wont_match expected_wonts
21
26
  # value { musts }.must_raise TypeError
22
27
  #
23
- # # good
24
- # _(musts).must_equal expected_musts
25
- # _(wonts).wont_match expected_wonts
26
- # _ { musts }.must_raise TypeError
27
- #
28
- # @example EnforcedStyle: any (default)
28
+ # @example EnforcedStyle: _
29
29
  # # bad
30
30
  # musts.must_equal expected_musts
31
31
  # wonts.wont_match expected_wonts
32
32
  # musts.must_raise TypeError
33
33
  #
34
- # # good
35
- # _(musts).must_equal expected_musts
36
- # _(wonts).wont_match expected_wonts
37
- # _ { musts }.must_raise TypeError
38
- #
39
34
  # expect(musts).must_equal expected_musts
40
35
  # expect(wonts).wont_match expected_wonts
41
36
  # expect { musts }.must_raise TypeError
@@ -44,6 +39,11 @@ module RuboCop
44
39
  # value(wonts).wont_match expected_wonts
45
40
  # value { musts }.must_raise TypeError
46
41
  #
42
+ # # good
43
+ # _(musts).must_equal expected_musts
44
+ # _(wonts).wont_match expected_wonts
45
+ # _ { musts }.must_raise TypeError
46
+ #
47
47
  # @example EnforcedStyle: expect
48
48
  # # bad
49
49
  # musts.must_equal expected_musts
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces correct order of expected and
6
+ # Enforces correct order of expected and
7
7
  # actual arguments for `assert_equal`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks if test cases contain too many assertion calls.
6
+ # Checks if test cases contain too many assertion calls.
7
7
  # The maximum allowed assertion calls is configurable.
8
8
  #
9
9
  # @example Max: 1
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks if test cases contain any assertion calls.
6
+ # Checks if test cases contain any assertion calls.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces to use `refute_empty` instead of
7
- # using `refute(object.empty?)`.
6
+ # Enforces to use `refute_empty` instead of using `refute(object.empty?)`.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `refute_equal(expected, object)`
6
+ # Enforces the use of `refute_equal(expected, object)`
7
7
  # over `assert(expected != actual)` or `assert(! expected == actual)`.
8
8
  #
9
9
  # @example
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `refute(object)`
7
- # over `assert_equal(false, object)`.
6
+ # Enforces the use of `refute(object)` over `assert_equal(false, object)`.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_in_delta`
6
+ # Enforces the test to use `refute_in_delta`
7
7
  # instead of using `refute_equal` to compare floats.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_includes`
6
+ # Enforces the test to use `refute_includes`
7
7
  # instead of using `refute(collection.include?(object))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `refute_instance_of(Class, object)`
6
+ # Enforces the use of `refute_instance_of(Class, object)`
7
7
  # over `refute(object.instance_of?(Class))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the use of `refute_kind_of(Class, object)`
6
+ # Enforces the use of `refute_kind_of(Class, object)`
7
7
  # over `refute(object.kind_of?(Class))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_match`
6
+ # Enforces the test to use `refute_match`
7
7
  # instead of using `refute(matcher.match(string))`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_nil` instead of using
6
+ # Enforces the test to use `refute_nil` instead of using
7
7
  # `refute_equal(nil, something)`, `refute(something.nil?)`, or `refute_predicate(something, :nil?)`.
8
8
  #
9
9
  # @example
@@ -3,8 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_path_exists`
7
- # instead of using `refute(File.exist?(path))`.
6
+ # Enforces the test to use `refute_path_exists` instead of using `refute(File.exist?(path))`.
8
7
  #
9
8
  # @example
10
9
  # # bad
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_predicate`
6
+ # Enforces the test to use `refute_predicate`
7
7
  # instead of using `refute(obj.a_predicate_method?)`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces the test to use `refute_respond_to(object, :do_something)`
6
+ # Enforces the test to use `refute_respond_to(object, :do_something)`
7
7
  # over `refute(object.respond_to?(:do_something))`.
8
8
  #
9
9
  # @example
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Minitest
6
+ # Checks that `ensure` call even if `skip`. It is unexpected that `ensure` will be called when skipping test.
7
+ # If conditional `skip` is used, it checks that `ensure` is also called conditionally.
8
+ #
9
+ # On the other hand, it accepts `skip` used in `rescue` because `ensure` may be teardown process to `begin`
10
+ # setup process.
11
+ #
12
+ # @example
13
+ #
14
+ # # bad
15
+ # def test_skip
16
+ # skip 'This test is skipped.'
17
+ #
18
+ # assert 'foo'.present?
19
+ # ensure
20
+ # do_something
21
+ # end
22
+ #
23
+ # # bad
24
+ # def test_conditional_skip
25
+ # skip 'This test is skipped.' if condition
26
+ #
27
+ # assert do_something
28
+ # ensure
29
+ # do_teardown
30
+ # end
31
+ #
32
+ # # good
33
+ # def test_skip
34
+ # skip 'This test is skipped.'
35
+ #
36
+ # begin
37
+ # assert 'foo'.present?
38
+ # ensure
39
+ # do_something
40
+ # end
41
+ # end
42
+ #
43
+ # # good
44
+ # def test_conditional_skip
45
+ # skip 'This test is skipped.' if condition
46
+ #
47
+ # assert do_something
48
+ # ensure
49
+ # if condition
50
+ # do_teardown
51
+ # end
52
+ # end
53
+ #
54
+ # # good
55
+ # def test_skip_is_used_in_rescue
56
+ # do_setup
57
+ # assert do_something
58
+ # rescue
59
+ # skip 'This test is skipped.'
60
+ # ensure
61
+ # do_teardown
62
+ # end
63
+ #
64
+ class SkipEnsure < Base
65
+ MSG = '`ensure` is called even though the test is skipped.'
66
+
67
+ def on_ensure(node)
68
+ skip = find_skip(node)
69
+
70
+ return if skip.nil? || use_skip_in_rescue?(skip) || valid_conditional_skip?(skip, node)
71
+
72
+ add_offense(node.loc.keyword)
73
+ end
74
+
75
+ private
76
+
77
+ def find_skip(node)
78
+ node.node_parts.first.descendants.detect { |n| n.send_type? && n.receiver.nil? && n.method?(:skip) }
79
+ end
80
+
81
+ def use_skip_in_rescue?(skip_method)
82
+ skip_method.ancestors.detect(&:rescue_type?)
83
+ end
84
+
85
+ def valid_conditional_skip?(skip_method, ensure_node)
86
+ if_node = skip_method.ancestors.detect(&:if_type?)
87
+ return false unless ensure_node.body.if_type?
88
+
89
+ match_keyword = ensure_node.body.if? ? if_node.if? : if_node.unless?
90
+ match_keyword && ensure_node.body.condition == if_node.condition
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop enforces that test method names start with `test_` prefix.
6
+ # Enforces that test method names start with `test_` prefix.
7
7
  # It aims to prevent tests that aren't executed by forgetting to start test method name with `test_`.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks for `assert_raises` has an assertion method at
6
+ # Checks for `assert_raises` has an assertion method at
7
7
  # the bottom of block because the assertion will be never reached.
8
8
  #
9
9
  # @example
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Minitest
6
- # This cop checks for a specified error in `assert_raises`.
6
+ # Checks for a specified error in `assert_raises`.
7
7
  #
8
8
  # @example
9
9
  # # bad
@@ -40,6 +40,7 @@ require_relative 'minitest/refute_instance_of'
40
40
  require_relative 'minitest/refute_path_exists'
41
41
  require_relative 'minitest/refute_predicate'
42
42
  require_relative 'minitest/refute_respond_to'
43
+ require_relative 'minitest/skip_ensure'
43
44
  require_relative 'minitest/test_method_name'
44
45
  require_relative 'minitest/unreachable_assertion'
45
46
  require_relative 'minitest/unspecified_exception'
@@ -16,10 +16,10 @@ module RuboCop
16
16
  # @param assertion_method [Symbol] Assertion method like `assert` or `refute`.
17
17
  # @param target_method [Symbol] Method name offensed by assertion method arguments.
18
18
  # @param preferred_method [Symbol] An optional param. Custom method name replaced by
19
- # auto-correction. The preferred method name that connects
19
+ # autocorrection. The preferred method name that connects
20
20
  # `assertion_method` and `target_method` with `_` is
21
21
  # the default name.
22
- # @param inverse [Boolean] An optional param. Order of arguments replaced by auto-correction.
22
+ # @param inverse [Boolean] An optional param. Order of arguments replaced by autocorrection.
23
23
  #
24
24
  def define_rule(assertion_method, target_method:, preferred_method: nil, inverse: false)
25
25
  preferred_method = "#{assertion_method}_#{target_method.to_s.delete('?')}" if preferred_method.nil?
@@ -10,8 +10,13 @@ module RuboCop
10
10
 
11
11
  def on_send(node)
12
12
  return unless (arguments = peel_redundant_parentheses_from(node.arguments))
13
- return unless arguments.first.respond_to?(:predicate_method?) && arguments.first.predicate_method?
14
- return unless arguments.first.arguments.count.zero?
13
+
14
+ first_argument = arguments.first
15
+
16
+ return unless first_argument
17
+ return if first_argument.block_type? || first_argument.numblock_type?
18
+ return unless predicate_method?(first_argument)
19
+ return unless first_argument.arguments.count.zero?
15
20
 
16
21
  add_offense(node, message: offense_message(arguments)) do |corrector|
17
22
  autocorrect(corrector, node, arguments)
@@ -34,6 +39,10 @@ module RuboCop
34
39
  peel_redundant_parentheses_from(arguments.first.children)
35
40
  end
36
41
 
42
+ def predicate_method?(first_argument)
43
+ first_argument.respond_to?(:predicate_method?) && first_argument.predicate_method?
44
+ end
45
+
37
46
  def offense_message(arguments)
38
47
  message_argument = arguments.last if arguments.first != arguments.last
39
48
 
@@ -55,7 +55,7 @@ module RuboCop
55
55
  # that there were no offenses. The `assert_offense` method has
56
56
  # to do more work by parsing out lines that contain carets.
57
57
  #
58
- # If the code produces an offense that could not be auto-corrected, you can
58
+ # If the code produces an offense that could not be autocorrected, you can
59
59
  # use `assert_no_corrections` after `assert_offense`.
60
60
  #
61
61
  # @example `assert_offense` and `assert_no_corrections`
@@ -93,7 +93,7 @@ module RuboCop
93
93
  def assert_offense(source, file = nil)
94
94
  setup_assertion
95
95
 
96
- @cop.instance_variable_get(:@options)[:auto_correct] = true
96
+ @cop.instance_variable_get(:@options)[:autocorrect] = true
97
97
 
98
98
  expected_annotations = RuboCop::RSpec::ExpectOffense::AnnotatedSource.parse(source)
99
99
  if expected_annotations.plain_source == source
@@ -176,7 +176,7 @@ module RuboCop
176
176
  end
177
177
 
178
178
  def ruby_version
179
- 2.5
179
+ 2.6
180
180
  end
181
181
  end
182
182
  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.19.0'
7
+ STRING = '0.20.1'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
data/relnotes/v0.12.0.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### Changes
6
6
 
7
- * [#129](https://github.com/rubocop/rubocop-minitest/pull/129): Drop Ruby 2.4 support. ([@koic][])
7
+ * [#129](https://github.com/rubocop/rubocop-minitest/pull/129): **(Compatibility)** Drop Ruby 2.4 support. ([@koic][])
8
8
 
9
9
  [@ghiculescu]: https://github.com/ghiculescu
10
10
  [@koic]: https://github.com/koic
data/relnotes/v0.15.2.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ### Bug fixes
2
2
 
3
- * [#145](https://github.com/rubocop/rubocop-minitest/pull/145): Mark `Minitest/AssertEmptyLiteral` as safe auto-correction. ([@koic][])
3
+ * [#145](https://github.com/rubocop/rubocop-minitest/pull/145): Mark `Minitest/AssertEmptyLiteral` as safe autocorrection. ([@koic][])
4
4
 
5
5
  [@koic]: https://github.com/koic
data/relnotes/v0.19.0.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ### New features
2
2
 
3
- * [#164](https://github.com/rubocop/rubocop-minitest/pull/164): Add new `Minitest/DuplicateTestRun cop. ([@ignacio-chiazzo][])
3
+ * [#164](https://github.com/rubocop/rubocop-minitest/pull/164): Add new `Minitest/DuplicateTestRun` cop. ([@ignacio-chiazzo][])
4
4
 
5
5
  [@ignacio-chiazzo]: https://github.com/ignacio-chiazzo
@@ -0,0 +1,5 @@
1
+ ### Bug fixes
2
+
3
+ * [#167](https://github.com/rubocop/rubocop-minitest/pull/167): Fix potential for valid Ruby code to be unparsable in `Minitest/DuplicateTestRun` cop. ([@gjtorikian][])
4
+
5
+ [@gjtorikian]: https://github.com/gjtorikian
@@ -0,0 +1,13 @@
1
+ ### New features
2
+
3
+ * [#169](https://github.com/rubocop/rubocop-minitest/issues/169): Add new `Minitest/SkipEnsure` cop. ([@koic][])
4
+
5
+ ### Bug fixes
6
+
7
+ * [#172](https://github.com/rubocop/rubocop-minitest/issues/172): Fix a false positive for `Minitest/AssertPredicate` and `Minitest/RefutePredicate` when using numbered parameters. ([@koic][])
8
+
9
+ ### Changes
10
+
11
+ * [#168](https://github.com/rubocop/rubocop-minitest/pull/168): **(Compatibility)** Drop Ruby 2.5 support. ([@koic][])
12
+
13
+ [@koic]: https://github.com/koic