Class: RuboCop::Cop::RSpecRails::MinitestAssertions::IncludesAssertion

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

Overview

:nodoc:

Constant Summary collapse

MATCHERS =
%i[
  assert_includes
  assert_not_includes
  refute_includes
].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(collection, expected, failure_message) ⇒ Object



148
149
150
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 148

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

.minitest_assertion(node) ⇒ Object



144
145
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 144

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

Instance Method Details

#assertionObject



152
153
154
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 152

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