diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-18 12:55:28 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-18 12:55:28 -0700 |
commit | 200708e7ed4928548bcd07b68e0ad8a60d8b6d86 (patch) | |
tree | 951a8b018c05841e0d65570f29ffbb962a504f4c /activemodel/test/cases | |
parent | 3a5a378056ceed24c37c8834d65c1985aae56879 (diff) | |
parent | fbf99653f14273773e4437390ecdca736f495fb9 (diff) | |
download | rails-200708e7ed4928548bcd07b68e0ad8a60d8b6d86.tar.gz rails-200708e7ed4928548bcd07b68e0ad8a60d8b6d86.tar.bz2 rails-200708e7ed4928548bcd07b68e0ad8a60d8b6d86.zip |
Merge pull request #1131 from joshk/active_model_xml_fix
Attributes with :string type should not be given the type passed in model. Closes #1058.
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/serializers/xml_serialization_test.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activemodel/test/cases/serializers/xml_serialization_test.rb b/activemodel/test/cases/serializers/xml_serialization_test.rb index 8f5c196850..f978191d22 100644 --- a/activemodel/test/cases/serializers/xml_serialization_test.rb +++ b/activemodel/test/cases/serializers/xml_serialization_test.rb @@ -92,7 +92,7 @@ class XmlSerializationTest < ActiveModel::TestCase test "should serialize string" do assert_match %r{<name>aaron stack</name>}, @contact.to_xml end - + test "should serialize nil" do assert_match %r{<pseudonyms nil=\"true\"></pseudonyms>}, @contact.to_xml(:methods => :pseudonyms) end @@ -132,4 +132,10 @@ class XmlSerializationTest < ActiveModel::TestCase xml = @contact.to_xml(:procs => [ proc ]) assert_match %r{<name-reverse>kcats noraa</name-reverse>}, xml end + + test "should serialize string correctly when type passed" do + xml = @contact.to_xml :type => 'Contact' + assert_match %r{<contact type="Contact">}, xml + assert_match %r{<name>aaron stack</name>}, xml + end end |