Open bogdan opened 2 months ago
assert_not_predicate
is rails specific, I have a PR for rubocop-rails
to handle this: https://github.com/rubocop/rubocop-rails/pull/1259. Also see https://github.com/rubocop/rubocop-rails/issues/1155
Will it fix others like assert_not array.include?(value)
?
Into what would this correct? I don't believe these methods work with arguments like that.
Sorry, my bad. No, this will not be handled by that PR. I can look into that once the other PR gets merged.
Hm, you are right assert_not_include
doesn't exist (which looks like a bug to me, but unrelated to rubocop in any wway). But assert_not_equal
, assert_not_nil
and many others do exist. The full list is here: https://api.rubyonrails.org/classes/ActiveSupport/TestCase.html#method-i-assert_no_match
refute array.include?(value)
corrects into assert_not_includes array, value
. Just one of those ruby File.exist?
/File.exists?
things I'd guess. Still, this is rails specific as well. Would you mind opening an issue in https://github.com/rubocop/rubocop-rails for that?
Bug Description
The rules
Minitest/Assert*
has some conflicts with Rails/RefuteMethods. It has default policy to convertrefute_*
statements toassert_not_*
which causesMinitest/Assert*
to be ignored.Example:
Fix
Make all rules consistent when converting generic
refute
orassert_not
statements torefute_*
orassert_not_*
statements making sure it supports default policy established byRails/RefuteMethods
: