Module: VCR::Errors::UnhandledXmlRequestError::Matchers
- Included in:
- VCR::Errors::UnhandledXmlRequestError
- Defined in:
- lib/vcr/errors/unhandled_xml_request_error/matchers.rb
Instance Method Summary collapse
- #body_matchers ⇒ Object
- #matched_by_body? ⇒ Boolean
- #matched_by_headers? ⇒ Boolean
- #matched_by_xpath? ⇒ Boolean
- #matchers ⇒ Object
- #xpath_matchers ⇒ Object
Instance Method Details
#body_matchers ⇒ Object
2 3 4 5 6 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 2 def body_matchers xpath_matchers.map do |m| "#{m.human_type}: #{m.xpath}" end.join('\n') end |
#matched_by_body? ⇒ Boolean
19 20 21 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 19 def matched_by_body? matchers.empty? || matchers.include?(:body) end |
#matched_by_headers? ⇒ Boolean
27 28 29 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 27 def matched_by_headers? matchers.empty? || matchers.include?(:headers) end |
#matched_by_xpath? ⇒ Boolean
23 24 25 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 23 def matched_by_xpath? matchers.empty? || matchers.any? { |m| /xpath:/.match m } end |
#matchers ⇒ Object
31 32 33 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 31 def matchers @matchers ||= VCR.http_interactions.request_matchers - [:method, :uri] # always POST to endpoint end |
#xpath_matchers ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vcr/errors/unhandled_xml_request_error/matchers.rb', line 8 def xpath_matchers @xpath_matchers ||= VCR.http_interactions.request_matchers.map do |m| matcher = VCR.request_matchers[m] if matcher.is_a?(VCR::XpathMatcher) || matcher.is_a?(VCR::NotXpathMatcher) matcher else nil end end.compact end |