File: test_node_inheritance.rb

package info (click to toggle)
ruby-nokogiri 1.11.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,576 kB
  • sloc: xml: 28,086; ruby: 18,456; java: 13,067; ansic: 5,138; yacc: 265; sh: 208; makefile: 27
file content (32 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# issue#560

require 'helper'

module Nokogiri
  module XML
    class TestNodeInheritance < Nokogiri::TestCase
      MyNode = Class.new Nokogiri::XML::Node
      def setup
        super
        @node = MyNode.new 'foo', Nokogiri::XML::Document.new
        @node['foo'] = 'bar' 
      end

      def test_node_name
        assert @node.name == 'foo'
      end

      def test_node_writing_an_attribute_accessing_via_attributes 
        assert @node.attributes['foo']
      end

      def test_node_writing_an_attribute_accessing_via_key 
        assert @node.key? 'foo'
      end

      def test_node_writing_an_attribute_accessing_via_brackets 
        assert @node['foo'] == 'bar'
      end
    end
  end
end