Class: RuboCop::Cop::Minitest::AssertPredicate

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
ArgumentRangeHelper, PredicateAssertionHandleable
Defined in:
lib/rubocop/cop/minitest/assert_predicate.rb

Overview

Enforces the test to use ‘assert_predicate` instead of using `assert(obj.a_predicate_method?)`.

Examples:

# bad
assert(obj.one?)
assert(obj.one?, 'message')

# good
assert_predicate(obj, :one?)
assert_predicate(obj, :one?, 'message')

Constant Summary collapse

MSG =
'Prefer using `assert_predicate(%<new_arguments>s)`.'
RESTRICT_ON_SEND =

rubocop:disable InternalAffairs/UselessRestrictOnSend

%i[assert].freeze

Method Summary

Methods included from PredicateAssertionHandleable

#autocorrect, #on_send