Sha256: 2be1f1664907785e12f537546998a9ad017d06578256cf08c71cedf4f2de92c9

Contents?: true

Size: 605 Bytes

Versions: 5

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true
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

5 entries across 5 versions & 1 rubygems

Version Path
mechanize-2.12.2 test/test_mechanize_xml_file.rb
mechanize-2.12.1 test/test_mechanize_xml_file.rb
mechanize-2.12.0 test/test_mechanize_xml_file.rb
mechanize-2.11.0 test/test_mechanize_xml_file.rb
mechanize-2.10.1 test/test_mechanize_xml_file.rb