Class: RuboCop::Cop::RSpecRails::MinitestAssertions::ResponseAssertion

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

Overview

:nodoc:

Constant Summary collapse

MATCHERS =
i[
  assert_response
].freeze
ASSERT_ACTUAL_NODE =
Struct.new(:source).new('response')

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, failure_message) ⇒ Object



333
334
335
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 333

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

.minitest_assertion(node) ⇒ Object



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

def_node_matcher 'self.minitest_assertion', "" # rubocop:disable InternalAffairs/NodeMatcherDirective

Instance Method Details

#assertionObject



337
338
339
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 337

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