Sha256: 064dfdf4e5c8742f3e1f24ef9c513be6efe7f8dc449dac7220da7b72742ab3af
Contents?: true
Size: 685 Bytes
Versions: 3
Compression:
Stored size: 685 Bytes
Contents
class String def to_xhtml css = nil node = Nokogiri::HTML(self) unless css node else nodes = node.css(css) raise "Elements for '#{css}' CSS query not found!" if nodes.size < 1 raise "Found more than one elment for '#{css}' CSS query!" if nodes.size > 1 nodes.first end end end ::Nokogiri::XML::Node.class_eval do def should_be_equal_to attributes attributes.stringify_keys! node_attributes = {} attributes.each do |k, v| nv = if k == 'content' self.content else self[k] end node_attributes[k] = nv end node_attributes.should == attributes end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
crystal-0.0.13 | lib/crystal/spec/xhtml.rb |
crystal-0.0.12 | lib/crystal/spec/xhtml.rb |
crystal_ext-0.0.11 | lib/crystal/spec/xhtml.rb |