Class: Pact::RSpec::Matchers::MatchHeader

Inherits:
Object
  • Object
show all
Includes:
Matchers, Matchers::Messages, RSpec2Delegator
Defined in:
lib/pact/provider/rspec/matchers.rb

Instance Method Summary collapse

Methods included from RSpec2Delegator

#method_missing

Methods included from Matchers::Messages

#expected_desc_for_it, #match_header_failure_message, #match_term_failure_message

Constructor Details

#initialize(header_name, expected) ⇒ MatchHeader

Returns a new instance of MatchHeader.



60
61
62
63
# File 'lib/pact/provider/rspec/matchers.rb', line 60

def initialize header_name, expected
  @header_name = header_name
  @expected = expected
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pact::RSpec::Matchers::RSpec2Delegator

Instance Method Details

#failure_messageObject



70
71
72
# File 'lib/pact/provider/rspec/matchers.rb', line 70

def failure_message
  match_header_failure_message @header_name, @expected, @actual
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
# File 'lib/pact/provider/rspec/matchers.rb', line 65

def matches? actual
  @actual = actual
  diff(@expected, @actual).empty?
end