diff options
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/serializeration/xml_serialization_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activemodel/test/cases/serializeration/xml_serialization_test.rb b/activemodel/test/cases/serializeration/xml_serialization_test.rb index 0737c4f2f9..428e5a6bd1 100644 --- a/activemodel/test/cases/serializeration/xml_serialization_test.rb +++ b/activemodel/test/cases/serializeration/xml_serialization_test.rb @@ -9,6 +9,11 @@ class Contact end end +module Admin + class Contact < ::Contact + end +end + class XmlSerializationTest < ActiveModel::TestCase def setup @contact = Contact.new @@ -25,6 +30,12 @@ class XmlSerializationTest < ActiveModel::TestCase assert_match %r{</contact>$}, @xml end + test "should serialize namespaced root" do + @xml = Admin::Contact.new(@contact.attributes).to_xml + assert_match %r{^<admin-contact>}, @xml + assert_match %r{</admin-contact>$}, @xml + end + test "should serialize default root with namespace" do @xml = @contact.to_xml :namespace => "http://xml.rubyonrails.org/contact" assert_match %r{^<contact xmlns="http://xml.rubyonrails.org/contact">}, @xml |