Class: WebTrap::RSpec::Matchers::SendRequestWithXml Private
- Inherits:
-
SendRequest
- Object
- SendRequest
- WebTrap::RSpec::Matchers::SendRequestWithXml
- Defined in:
- lib/webtrap/rspec/matchers/send_request_with_xml.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Used to specify the XML payload of the request.
Instance Attribute Summary collapse
-
#expected_payload ⇒ Object
readonly
private
Reference to be compared with the payload of outgoing XML requests.
Instance Method Summary collapse
-
#failure_message ⇒ String
private
Message to be shown if the expectation fails to pass.
-
#initialize(expected_payload) ⇒ SendRequestWithXml
constructor
private
Allows the parameterization of the matcher with the reference payload.
-
#matches?(transmission_proc) ⇒ Boolean
private
Checks if the provided Proc sends a request with an XML payload equivalent to the expected reference.
-
#supports_block_expectations? ⇒ TrueClass
private
Allows the matcher to be used with block expectations.
Methods inherited from SendRequest
Constructor Details
#initialize(expected_payload) ⇒ SendRequestWithXml
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allows the parameterization of the matcher with the reference payload.
18 19 20 |
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 18 def initialize(expected_payload) @expected_payload = expected_payload end |
Instance Attribute Details
#expected_payload ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reference to be compared with the payload of outgoing XML requests.
13 14 15 |
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 13 def expected_payload @expected_payload end |
Instance Method Details
#failure_message ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Message to be shown if the expectation fails to pass.
39 40 41 42 43 |
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 39 def 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Checks if the provided Proc sends a request with an XML payload equivalent to the expected reference.
30 31 32 33 |
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 30 def matches?(transmission_proc) perform_transmission(transmission_proc) request_sent? && valid_payload? end |
#supports_block_expectations? ⇒ TrueClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allows the matcher to be used with block expectations.
49 50 51 |
# File 'lib/webtrap/rspec/matchers/send_request_with_xml.rb', line 49 def supports_block_expectations? true end |