Sha256: 437294edd7b3679a3ce207582e35e2a1a85a9d9e2cabbd0e4d20e960668b115a

Contents?: true

Size: 575 Bytes

Versions: 22

Compression:

Stored size: 575 Bytes

Contents

require 'mechanize/test_case'

class TestMechanizeXmlFile < Mechanize::TestCase

  def setup
    super

    uri = URI 'http://example.com/foo.xml'
    @xml = Mechanize::XmlFile.new uri, nil, <<-XML
      <languages>
        <language>Ruby</language>
        <language>Perl</language>
      </languages>
    XML
  end

  def test_xml
    assert_kind_of Nokogiri::XML::Document, @xml.xml
  end

  def test_search
    assert_equal ['Ruby', 'Perl'], @xml.search('language').map { |n| n.text }
  end

  def test_at
    assert_equal 'Perl', @xml.at('//language[2]').text
  end

end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
mechanize-2.10.0 test/test_mechanize_xml_file.rb
mechanize-2.9.2 test/test_mechanize_xml_file.rb
mechanize-2.9.1 test/test_mechanize_xml_file.rb
mechanize-2.9.0 test/test_mechanize_xml_file.rb
mechanize-2.8.5 test/test_mechanize_xml_file.rb
mechanize-2.8.4 test/test_mechanize_xml_file.rb
mechanize-2.8.3 test/test_mechanize_xml_file.rb
mechanize-2.8.2 test/test_mechanize_xml_file.rb
mechanize-2.8.1 test/test_mechanize_xml_file.rb
mechanize-2.8.0 test/test_mechanize_xml_file.rb
mechanize-2.7.7 test/test_mechanize_xml_file.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_xml_file.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_xml_file.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_xml_file.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_xml_file.rb
mechanize-2.7.6 test/test_mechanize_xml_file.rb
mechanize-2.7.5 test/test_mechanize_xml_file.rb
mechanize-2.7.4 test/test_mechanize_xml_file.rb
mechanize-2.7.3 test/test_mechanize_xml_file.rb
mechanize-2.7.2 test/test_mechanize_xml_file.rb