Sha256: d10497674571c58c94b266adae117fea079e4a6a8d8c899f2c20c41f89dd74a5

Contents?: true

Size: 887 Bytes

Versions: 72

Compression:

Stored size: 887 Bytes

Contents

require "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

72 entries across 72 versions & 15 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/nokogiri-1.5.0/test/xml/test_node_attributes.rb
iisconfig-0.0.1.pre2 build/bundler/ruby/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/test/xml/test_node_attributes.rb
iisconfig-0.0.1.pre1 build/bundler/ruby/1.9.1/gems/nokogiri-1.5.0-x86-mingw32/test/xml/test_node_attributes.rb
domo-0.0.5 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.0/test/xml/test_node_attributes.rb
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/test/xml/test_node_attributes.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/test/xml/test_node_attributes.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/test/xml/test_node_attributes.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/nokogiri-1.5.0/test/xml/test_node_attributes.rb
nokogiri-maven-1.5.0-java test/xml/test_node_attributes.rb
nokogiri-maglev--1.5.0.1 test/xml/test_node_attributes.rb
nokogiri-1.5.0-java test/xml/test_node_attributes.rb
nokogiri-1.5.0-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.5.0-x86-mswin32-60 test/xml/test_node_attributes.rb
nokogiri-1.5.0 test/xml/test_node_attributes.rb
nokogiri-1.4.7-java test/xml/test_node_attributes.rb
nokogiri-1.4.7-x86-mingw32 test/xml/test_node_attributes.rb
nokogiri-1.4.7-x86-mswin32-60 test/xml/test_node_attributes.rb
nokogiri-1.4.7 test/xml/test_node_attributes.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/test/xml/test_node_attributes.rb
nokogiri-1.4.6 test/xml/test_node_attributes.rb