Sha256: 6c659bbd9603951ea0e412a1448eae1c4b7d83c7a516a0a5e4f5450cbc4457bb

Contents?: true

Size: 931 Bytes

Versions: 68

Compression:

Stored size: 931 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'hpricot'
require 'load_files'

class TestParser < Test::Unit::TestCase
  # 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)
    assert_equal "hourly", (doc.at "sy:updatePeriod").inner_html
    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

68 entries across 68 versions & 15 rubygems

Version Path
webtranslateit-hpricot-0.9.0 test/test_xml.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/test/test_xml.rb
adamh-hpricot-0.6.168 test/test_xml.rb
adamh-hpricot-0.6.169 test/test_xml.rb
adamh-hpricot-0.6.170 test/test_xml.rb
adamh-hpricot-0.6.171 test/test_xml.rb
adamh-hpricot-0.6.210 test/test_xml.rb
adamh-hpricot-0.6.211 test/test_xml.rb
adamh-hpricot-0.7.229 test/test_xml.rb
hpricot-hpricot-0.7.229 test/test_xml.rb
jerryvos-hpricot-0.8.1 test/test_xml.rb
jerryvos-jerryvos-hpricot-0.7.230 test/test_xml.rb
jordan-brough-hpricot-0.7.229 test/test_xml.rb
martiantim-hpricot-0.8.236 test/test_xml.rb
mperham-hpricot-0.8.1.1 test/test_xml.rb
stepheneb-hpricot-0.8.265 test/test_xml.rb
stepheneb-hpricot-0.8.268 test/test_xml.rb
why-hpricot-0.6.201 test/test_xml.rb
why-hpricot-0.6.204 test/test_xml.rb
why-hpricot-0.6.207 test/test_xml.rb