Skip to content

Commit

Permalink
Adds node inheritance test for issue#560.
Browse files Browse the repository at this point in the history
  • Loading branch information
yokolet committed Nov 18, 2011
1 parent d05f37f commit be4851d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Manifest.txt
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions 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

0 comments on commit be4851d

Please sign in to comment.