rubocop-minitest
rubocop-minitest copied to clipboard
[Bug] Minitest/Assert* having conflicts with Rails/RefuteMethods policy
Bug Description
The rules Minitest/Assert*
has some conflicts with Rails/RefuteMethods. It has default policy to convert refute_*
statements to assert_not_*
which causes Minitest/Assert*
to be ignored.
Example:
# Statement
refute user.new_record?
# Will be converted by Rails/RefuteMethods to
assert_not user.new_record?
# And will be ignored by Minitest/AssertPredicate
Fix
Make all rules consistent when converting generic refute
or assert_not
statements to refute_*
or assert_not_*
statements making sure it supports default policy established by Rails/RefuteMethods
:
# bad
assert_not(obj.one?)
assert_not(obj.one?, 'message')
# good
assert_not_predicate(obj, :one?)
assert_not_predicate(obj, :one?, 'message')