Class: RuboCop::Cop::RSpecRails::MinitestAssertions::NilAssertion

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

Overview

:nodoc:

Constant Summary collapse

MATCHERS =
%i[
  assert_nil
  assert_not_nil
  refute_nil
].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(actual, failure_message) ⇒ Object



243
244
245
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 243

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

.minitest_assertion(node) ⇒ Object



239
240
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 239

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

Instance Method Details

#assertionObject



247
248
249
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 247

def assertion
  'eq(nil)'
end