Class: WebTrap::RSpec::Matchers::SendRequestWithXml

Inherits:
SendRequest
  • Object
show all
Defined in:
lib/webtrap/rspec/matchers/send_request_with_xml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SendRequest

#with_xml

Constructor Details

#initialize(expected_payload) ⇒ SendRequestWithXml

Returns a new instance of SendRequestWithXml.



10
11
12
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 10

def initialize(expected_payload)
  @expected_payload = expected_payload
end

Instance Attribute Details

#expected_payloadObject (readonly)

Returns the value of attribute expected_payload.



8
9
10
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 8

def expected_payload
  @expected_payload
end

Instance Method Details

#failure_messageObject



19
20
21
22
23
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 19

def failure_message
  return super unless request_sent?

  "expected block to send an HTTP request with XML body, but payload was not equivalent"
end

#matches?(transmission_proc) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 14

def matches?(transmission_proc)
  perform_transmission(transmission_proc)
  request_sent? && valid_payload?
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 25

def supports_block_expectations?
  true
end