Skip to content

Commit

Permalink
[Fix rubocop#113] Fix an error for Minitest/AssertEqual
Browse files Browse the repository at this point in the history
Fixes rubocop#113.

This PR fixes an error for `Minitest/AssertEqual` and some cops
when using `assert` with block argument.
  • Loading branch information
koic committed Dec 24, 2020
1 parent da04056 commit ad0c3e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bug fixes

* [#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][])

## 0.10.1 (2020-07-25)

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/mixin/minitest_cop_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def autocorrect(node)
private
def peel_redundant_parentheses_from(arguments)
return arguments unless arguments.first.begin_type?
return arguments unless arguments.first&.begin_type?
peel_redundant_parentheses_from(arguments.first.children)
end
Expand Down
7 changes: 7 additions & 0 deletions test/rubocop/cop/minitest/assert_equal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,11 @@ def test_do_something
end
RUBY
end

# See: https://github.com/rubocop-hq/rubocop-minitest/issues/113
def test_does_not_register_offense_when_assert_with_block_argument
assert_no_offenses(<<~RUBY)
assert { 1 + 2 == 3 }
RUBY
end
end

0 comments on commit ad0c3e9

Please sign in to comment.