Sha256: ff7ff0cd06d199e19124eb35b71e083542ba509c7ae019d71d2ebb3d8820146e
Contents?: true
Size: 853 Bytes
Versions: 3
Compression:
Stored size: 853 Bytes
Contents
require "nokogiri" def equal_to_dom(text) EqualToDom.new(text) end def include_dom(text) IncludeDom.new(text) end class IncludeDom def initialize(expectation) @expectation = Nokogiri::HTML::DocumentFragment.parse(expectation).to_s end def matches?(text) @matcher = Nokogiri::HTML::DocumentFragment.parse(text).to_s @matcher == @expectation end def failure_message "Expected dom #{@matcher.inspect} to include #{@expectation.inspect}, but it wasn't" end end class EqualToDom def initialize(expectation) @expectation = Nokogiri::HTML::DocumentFragment.parse(expectation).to_s end def matches?(text) @matcher = Nokogiri::HTML::DocumentFragment.parse(text).to_s @matcher == @expectation end def failure_message "Expected dom #{@matcher} to match #{@expectation}, but it wasn't" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datagrid-0.3.2 | spec/support/equal_to_dom.rb |
datagrid-0.3.1 | spec/support/equal_to_dom.rb |
datagrid-0.3.0 | spec/support/equal_to_dom.rb |