Sha256: b434395fad98dd9a5b8c2eed3b4c74a35a0bf82e4a579b00fb98015fcaf236e5
Contents?: true
Size: 646 Bytes
Versions: 36
Compression:
Stored size: 646 Bytes
Contents
require 'test/unit' require 'nokogiri' class XPathTest < Test::Unit::TestCase def setup file = File.open( "xpath_bug.xml" ) @doc = Nokogiri::HTML::Document.read_io(file, nil, nil, 2145) end def fixture xpath matches = [] @doc.xpath(xpath).each() do |node| matches << node assert_equal('Add', node.text) assert_equal('ButtonText', node['class']) end assert_equal(1, matches.length) end def test_text fixture "//div[text()='Add' and @class='ButtonText']" end def test_contains fixture "//div[contains(.,'Add') and @class='ButtonText']" end end
Version data entries
36 entries across 36 versions & 2 rubygems