Module: IsoDoc::SpecHelpers::CanonHtmlInputGuard
- Defined in:
- lib/isodoc/spec_helpers/canon_html_input_guard.rb
Overview
Prepended onto Canon::RSpecMatchers::SerializationMatcher to intercept matches? before Canon’s own implementation runs.
Constant Summary collapse
- ILLEGAL_HTML_PREFIX =
/\A\s*<\?xml\b/i.freeze
Instance Method Summary collapse
Instance Method Details
#matches?(target) ⇒ Boolean
41 42 43 44 45 46 47 48 |
# File 'lib/isodoc/spec_helpers/canon_html_input_guard.rb', line 41 def matches?(target) if html_format? && (illegal_prefix?(@expected) || illegal_prefix?(target)) side = illegal_prefix?(@expected) ? "expected" : "received" raise CanonGuardError, (side) end super end |