Skip to content

Commit

Permalink
Suppress warning: method redefined; discarding old on_send
Browse files Browse the repository at this point in the history
This PR suppresses the following warning.

```console
% bundle exec rake

/Users/koic/src/github.com/rubocop/rubocop-minitest/lib/rubocop/cop/minitest/assert_empty.rb:23:
warning: method redefined; discarding old on_send
/Users/koic/src/github.com/rubocop/rubocop-minitest/lib/rubocop/cop/mixin/minitest_cop_rule.rb:34:
warning: previous definition of on_send was here
/Users/koic/src/github.com/rubocop/rubocop-minitest/lib/rubocop/cop/minitest/refute_empty.rb:23:
warning: method redefined; discarding old on_send
/Users/koic/src/github.com/rubocop/rubocop-minitest/lib/rubocop/cop/mixin/minitest_cop_rule.rb:34:
warning: previous definition of on_send was here
```
  • Loading branch information
koic committed Nov 8, 2021
1 parent 8bb4f29 commit 80c80ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rubocop/cop/minitest/assert_empty.rb
Expand Up @@ -20,6 +20,7 @@ class AssertEmpty < Base

define_rule :assert, target_method: :empty?

remove_method :on_send
def on_send(node)
return unless node.method?(:assert)
return unless (arguments = peel_redundant_parentheses_from(node.arguments))
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/minitest/refute_empty.rb
Expand Up @@ -20,6 +20,7 @@ class RefuteEmpty < Base

define_rule :refute, target_method: :empty?

remove_method :on_send
def on_send(node)
return unless node.method?(:refute)
return unless (arguments = peel_redundant_parentheses_from(node.arguments))
Expand Down

0 comments on commit 80c80ef

Please sign in to comment.