Module: Spec::Matchers::FormMatcher::LibXML
- Defined in:
- lib/rspec_form_matcher.rb
Instance Method Summary collapse
Instance Method Details
#check_xpath! ⇒ Object
130 131 132 |
# File 'lib/rspec_form_matcher.rb', line 130 def check_xpath! !@document.find_first(@xpath).nil? end |
#document(subject) ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/rspec_form_matcher.rb', line 134 def document(subject) if String === subject XML::HTMLParser.string(subject).parse elsif subject.respond_to?(:body) XML::HTMLParser.string(subject.body).parse elsif XML::Node === subject subject elsif XML::Document === subject subject else raise "Cannot handle this XML input type" end end |