diff --git a/test/xml/test_node_reparenting.rb b/test/xml/test_node_reparenting.rb index dd37fb56530..d7909b6937b 100644 --- a/test/xml/test_node_reparenting.rb +++ b/test/xml/test_node_reparenting.rb @@ -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