From fbf99653f14273773e4437390ecdca736f495fb9 Mon Sep 17 00:00:00 2001 From: Jim Herzberg Date: Wed, 18 May 2011 15:52:55 -0400 Subject: Attributes with :string type should not be given the type passed in model serialization options. Closes #1058 --- activemodel/test/cases/serializers/xml_serialization_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activemodel/test/cases/serializers/xml_serialization_test.rb') 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{aaron stack}, @contact.to_xml end - + test "should serialize nil" do assert_match %r{}, @contact.to_xml(:methods => :pseudonyms) end @@ -132,4 +132,10 @@ class XmlSerializationTest < ActiveModel::TestCase xml = @contact.to_xml(:procs => [ proc ]) assert_match %r{kcats noraa}, xml end + + test "should serialize string correctly when type passed" do + xml = @contact.to_xml :type => 'Contact' + assert_match %r{}, xml + assert_match %r{aaron stack}, xml + end end -- cgit v1.2.3