Skip to content

Commit

Permalink
Merge pull request #723 from adhearsion/feature/prefixed_attribute_ac…
Browse files Browse the repository at this point in the history
…cessors

Merges failing test case for issue #712 and #695.

Thanks!
  • Loading branch information
yokolet committed Jul 8, 2012
2 parents 0d8c3f2 + fac8b97 commit 130a942
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/xml/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,15 @@ def test_namespace_without_prefix_should_be_set
assert_nil ns.prefix
assert_equal ns.href, "http://bar.com"
end

# issue 695
def test_namespace_in_rendered_xml
document = Nokogiri::XML::Document.new
subject = Nokogiri::XML::Node.new 'foo', document
ns = subject.add_namespace nil, 'bar'
subject.namespace = ns
assert_match subject.to_xml, /xmlns="bar"/
end
end
end
end
9 changes: 9 additions & 0 deletions test/xml/test_node_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ def test_attribute_with_ns
node.attribute_with_ns('foo', 'http://tenderlovemaking.com/').value
end

def test_prefixed_attributes
doc = Nokogiri::XML "<root xml:lang='en-GB' />"

node = doc.root

assert_equal 'en-GB', node[:'xml:lang']
assert_equal nil, node[:lang]
end

def test_namespace_key?
doc = Nokogiri::XML <<-eoxml
<root xmlns:tlm='http://tenderlovemaking.com/'>
Expand Down

0 comments on commit 130a942

Please sign in to comment.