Sha256: 2c8494f934bc1fe7f82c52b737375306ea725b7597222b3bbcdfc2306f1bc453
Contents?: true
Size: 844 Bytes
Versions: 3
Compression:
Stored size: 844 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.include?(@expectation) end def failure_message "Expected dom #{@matcher} to include #{@expectation}, 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.1.1 | spec/support/equal_to_dom.rb |
datagrid-0.1.0 | spec/support/equal_to_dom.rb |
datagrid-0.0.3 | spec/support/equal_to_dom.rb |