Sha256: 702ca98dd3245aa77e7c527abd2fd6b8b92e401d97b857f8ad7a30dcef99353b

Contents?: true

Size: 946 Bytes

Versions: 19

Compression:

Stored size: 946 Bytes

Contents

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

module Nokogiri
  module XML
    class TestNodeAttributes < Nokogiri::TestCase
      def test_attribute_with_ns
        doc = Nokogiri::XML <<-eoxml
          <root xmlns:tlm='http://tenderlovemaking.com/'>
            <node tlm:foo='bar' foo='baz' />
          </root>
        eoxml

        node = doc.at('node')

        assert_equal 'bar',
          node.attribute_with_ns('foo', 'http://tenderlovemaking.com/').value
      end

      def test_namespace_key?
        doc = Nokogiri::XML <<-eoxml
          <root xmlns:tlm='http://tenderlovemaking.com/'>
            <node tlm:foo='bar' foo='baz' />
          </root>
        eoxml

        node = doc.at('node')

        assert node.namespaced_key?('foo', 'http://tenderlovemaking.com/')
        assert node.namespaced_key?('foo', nil)
        assert !node.namespaced_key?('foo', 'foo')
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_node_attributes.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_node_attributes.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_node_attributes.rb
nokogiri-1.3.3-x86-mswin32 test/xml/test_node_attributes.rb
nokogiri-1.3.3-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.3.3-java test/xml/test_node_attributes.rb
nokogiri-1.3.2-x86-mswin32 test/xml/test_node_attributes.rb
nokogiri-1.3.2-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.3.2-java test/xml/test_node_attributes.rb
nokogiri-1.3.0-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.3.2 test/xml/test_node_attributes.rb
nokogiri-1.3.3 test/xml/test_node_attributes.rb
nokogiri-1.3.0-java test/xml/test_node_attributes.rb
nokogiri-1.3.1-java test/xml/test_node_attributes.rb
nokogiri-1.3.0-x86-mswin32 test/xml/test_node_attributes.rb
nokogiri-1.3.0 test/xml/test_node_attributes.rb
nokogiri-1.3.1-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.3.1 test/xml/test_node_attributes.rb
nokogiri-1.3.1-x86-mswin32 test/xml/test_node_attributes.rb