Skip to content

Commit

Permalink
add first test from @ccutrer's #1333
Browse files Browse the repository at this point in the history
and use same pattern in the existing test

related to #1332
  • Loading branch information
flavorjones committed May 30, 2016
1 parent 3970512 commit e6c3b04
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/xml/test_node_reparenting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,23 @@ class TestNodeReparenting < Nokogiri::TestCase

it "inserts a node that inherits the matching parent namespace" do
@node.add_child(@child)
assert @doc.at('//foo:second', "foo" => "http://flavorjon.es/")
assert reparented = @doc.at('//bar:second', "bar" => "http://flavorjon.es/")
assert reparented.namespace_definitions.empty?
assert_equal @ns, reparented.namespace
end
end

describe "but with a different prefix" do
before do
@ns = @child.add_namespace(nil, 'http://flavorjon.es/')
@child.namespace = @ns
end

it "inserts a node that keeps its namespace" do
@node.add_child(@child)
assert reparented = @doc.at('//bar:second', "bar" => "http://flavorjon.es/")
assert reparented.namespace_definitions.include?(@ns)
assert_equal @ns, reparented.namespace
end
end
end
Expand Down

0 comments on commit e6c3b04

Please sign in to comment.