Sha256: 18377110516149a0ae1a67aa079ff66504eb1acfe8c9a6133b29fd81e6efe3f9

Contents?: true

Size: 1.07 KB

Versions: 23

Compression:

Stored size: 1.07 KB

Contents

require "helper"

module Nokogiri
  module XML
    class TestAttr < Nokogiri::TestCase
      def test_new
        100.times {
          doc = Nokogiri::XML::Document.new
          attribute = Nokogiri::XML::Attr.new(doc, 'foo')
        }
      end

      def test_content=
        xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
        address = xml.xpath('//address')[3]
        street = address.attributes['street']
        street.content = "Y&ent1;"
        assert_equal "Y&ent1;", street.value
      end

      def test_value=
        xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
        address = xml.xpath('//address')[3]
        street = address.attributes['street']
        street.value = "Y&ent1;"
        assert_equal "Y&ent1;", street.value
      end

      def test_unlink
        xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
        address = xml.xpath('/staff/employee/address').first
        assert_equal 'Yes', address['domestic']
        address.attribute_nodes.first.unlink
        assert_nil address['domestic']
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 7 rubygems

Version Path
glebm-nokogiri-1.4.2.1 test/xml/test_attr.rb
nokogiri-1.5.0.beta.1 test/xml/test_attr.rb
nokogiri-1.4.2.1-x86-mswin32 test/xml/test_attr.rb
nokogiri-1.4.2.1-x86-mingw32 test/xml/test_attr.rb
nokogiri-1.5.0.beta.1-java test/xml/test_attr.rb
nokogiri-1.4.2-java test/xml/test_attr.rb
nokogiri-1.4.2 test/xml/test_attr.rb
rubyjedi-nokogiri_java-1.4.0.20100513161003-java test/xml/test_attr.rb
jwagener-nokogiri-1.4.1 test/xml/test_attr.rb
revo-nokogiri-1.4.1-java test/xml/test_attr.rb
revo-nokogiri-1.4.0.3-java test/xml/test_attr.rb
revo-nokogiri-1.4.0-java test/xml/test_attr.rb
revo-nokogiri-1.4.0.20100202165440-java test/xml/test_attr.rb
nokogiri-1.4.1-x86-mswin32 test/xml/test_attr.rb
nokogiri-1.4.1-x86-mingw32 test/xml/test_attr.rb
nokogiri-1.4.1-java test/xml/test_attr.rb
nokogiri-1.4.1 test/xml/test_attr.rb
superfeedr-nokogiri-1.4.0.20091116183308 test/xml/test_attr.rb
caring-nokogiri-1.4.1.pre1 test/xml/test_attr.rb
nokogiri-1.4.0-java test/xml/test_attr.rb