diff --git a/Manifest.txt b/Manifest.txt index f1481134dc..8973ad8fcc 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -270,6 +270,7 @@ test/xml/test_node_attributes.rb test/xml/test_node_encoding.rb test/xml/test_node_reparenting.rb test/xml/test_node_set.rb +test/xml/test_node_inheritance.rb test/xml/test_parse_options.rb test/xml/test_processing_instruction.rb test/xml/test_reader_encoding.rb diff --git a/test/xml/test_node_inheritance.rb b/test/xml/test_node_inheritance.rb new file mode 100644 index 0000000000..760e3329ff --- /dev/null +++ b/test/xml/test_node_inheritance.rb @@ -0,0 +1,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