Class: WebTrap::Shared::Validators::EquivalentXmlContentValidator Private
- Inherits:
-
Object
- Object
- WebTrap::Shared::Validators::EquivalentXmlContentValidator
- Defined in:
- lib/webtrap/shared/validators/equivalent_xml_content_validator.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.
Validator for asserting a request was sent with an equivalent XML payload.
Instance Method Summary collapse
-
#failed? ⇒ Boolean
private
Whether no request with an equivalent payload was validated.
-
#failure_message ⇒ String
private
The message to be used if no request is validated with an equivalent payload.
-
#initialize(xml) ⇒ EquivalentXmlContentValidator
constructor
private
Instantiate a new validator with the provided payload.
-
#validate(request) ⇒ EquivalentXmlContentValidator
private
Validate if the request has an equivalent XML payload.
Constructor Details
#initialize(xml) ⇒ EquivalentXmlContentValidator
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.
Instantiate a new validator with the provided payload.
15 16 17 18 |
# File 'lib/webtrap/shared/validators/equivalent_xml_content_validator.rb', line 15 def initialize(xml) @failed = true @xml = xml end |
Instance Method Details
#failed? ⇒ 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.
Whether no request with an equivalent payload was validated.
23 24 25 |
# File 'lib/webtrap/shared/validators/equivalent_xml_content_validator.rb', line 23 def failed? @failed end |
#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.
The message to be used if no request is validated with an equivalent payload.
31 32 33 |
# File 'lib/webtrap/shared/validators/equivalent_xml_content_validator.rb', line 31 def "expected block to send an HTTP request with XML body, but payload was not equivalent" end |
#validate(request) ⇒ EquivalentXmlContentValidator
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.
Validate if the request has an equivalent XML payload.
41 42 43 44 |
# File 'lib/webtrap/shared/validators/equivalent_xml_content_validator.rb', line 41 def validate(request) @failed = EquivalentXml.equivalent?(xml, request["rack.input"].string) self end |