Class: RuboCop::Cop::RSpecRails::MinitestAssertions::InstanceOfAssertion

Inherits:
BasicAssertion
  • Object
show all
Defined in:
lib/rubocop/cop/rspec_rails/minitest_assertions.rb

Overview

:nodoc:

Constant Summary collapse

MATCHERS =
%i[
  assert_instance_of
  assert_not_instance_of
  refute_instance_of
].freeze

Instance Attribute Summary

Attributes inherited from BasicAssertion

#actual, #expected, #failure_message

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicAssertion

#initialize, #negated?, #replaced

Constructor Details

This class inherits a constructor from RuboCop::Cop::RSpecRails::MinitestAssertions::BasicAssertion

Class Method Details

.match(expected, actual, failure_message) ⇒ Object



126
127
128
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 126

def self.match(expected, actual, failure_message)
  new(expected, actual, failure_message.first)
end

.minitest_assertion(node) ⇒ Object



122
123
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 122

def_node_matcher 'self.minitest_assertion', <<~PATTERN # rubocop:disable InternalAffairs/NodeMatcherDirective
(send nil? {:assert_instance_of :assert_not_instan

Instance Method Details

#assertionObject



130
131
132
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 130

def assertion
  "be_an_instance_of(#{expected})"
end