diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-07-22 21:06:34 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-07-22 21:06:34 -0500 |
commit | 272c504f919d187603915059572e37d3a78329cc (patch) | |
tree | 235c0fb9b33eda67087b3c3fca55eef1b7547ca3 /activemodel/test/cases | |
parent | c39151a84768397d3bb025c6e8f877eac59ebbf9 (diff) | |
download | rails-272c504f919d187603915059572e37d3a78329cc.tar.gz rails-272c504f919d187603915059572e37d3a78329cc.tar.bz2 rails-272c504f919d187603915059572e37d3a78329cc.zip |
Dasherize XML root by default to avoid invalid tags "<admin/posts>...</admin/posts>" [#2875 state:resolved]
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 |