Sha256: a2348eb36c9828c6a426f6e350c7ad95975659df840ade2e01a3ae09c04ddbec

Contents?: true

Size: 1.13 KB

Versions: 44

Compression:

Stored size: 1.13 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
require File.join(File.dirname(__FILE__),"load_files")

class TestParser < Nokogiri::TestCase
  include Nokogiri
  # normally, the link tags are empty HTML tags.
  # contributed by laudney.
  def test_normally_empty
    doc = Hpricot::XML("<rss><channel><title>this is title</title><link>http://fake.com</link></channel></rss>")
    assert_equal "this is title", (doc/:rss/:channel/:title).text
    assert_equal "http://fake.com", (doc/:rss/:channel/:link).text
  end

  # make sure XML doesn't get downcased
  def test_casing
    doc = Hpricot::XML(TestFiles::WHY)

    ### Modified.
    # I don't want to differentiate pseudo classes from namespaces.  If
    # you're parsing xml, use XPath.  That's what its for.  :-P
    assert_equal "hourly", (doc.at "//sy:updatePeriod").content
    assert_equal 1, (doc/"guid[@isPermaLink]").length
  end

  # be sure tags named "text" are ok
  def test_text_tags
    doc = Hpricot::XML("<feed><title>City Poisoned</title><text>Rita Lee has poisoned Brazil.</text></feed>")
    assert_equal "City Poisoned", (doc/"title").text
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
tenderlove-nokogiri-0.0.0-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.3.2-x86-mswin32 test/hpricot/test_xml.rb
nokogiri-1.3.2-x86-mingw32 test/hpricot/test_xml.rb
nokogiri-1.3.2-java test/hpricot/test_xml.rb
nokogiri-1.3.0-x86-mingw32 test/hpricot/test_xml.rb
nokogiri-1.3.2 test/hpricot/test_xml.rb
nokogiri-1.0.0 test/hpricot/test_xml.rb
nokogiri-1.0.0-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.0.1 test/hpricot/test_xml.rb
nokogiri-1.0.2 test/hpricot/test_xml.rb
nokogiri-1.0.3-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.0.5-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.0.4-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.0.4 test/hpricot/test_xml.rb
nokogiri-1.0.3 test/hpricot/test_xml.rb
nokogiri-1.0.5 test/hpricot/test_xml.rb
nokogiri-1.0.6 test/hpricot/test_xml.rb
nokogiri-1.0.6-x86-mswin32-60 test/hpricot/test_xml.rb
nokogiri-1.1.0 test/hpricot/test_xml.rb
nokogiri-1.1.0-x86-mswin32-60 test/hpricot/test_xml.rb