Class: RuboCop::Cop::Minitest::RefuteInstanceOf

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
InstanceOfAssertionHandleable
Defined in:
lib/rubocop/cop/minitest/refute_instance_of.rb

Overview

Enforces the use of ‘refute_instance_of(Class, object)` over `refute(object.instance_of?(Class))`.

Examples:

# bad
refute(object.instance_of?(Class))
refute(object.instance_of?(Class), 'message')

# bad
refute_equal(Class, object.class)
refute_equal(Class, object.class, 'message')

# good
refute_instance_of(Class, object)
refute_instance_of(Class, object, 'message')

Constant Summary collapse

RESTRICT_ON_SEND =
%i[refute refute_equal].freeze

Constants included from InstanceOfAssertionHandleable

InstanceOfAssertionHandleable::MSG

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



35
36
37
# File 'lib/rubocop/cop/minitest/refute_instance_of.rb', line 35

def on_send(node)
  investigate(node, :refute)
end