diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-10 09:41:28 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-10 09:41:28 -0700 |
commit | ceaf73a503814d000167503888a62c1a393730d4 (patch) | |
tree | 28fed0ac20ba91f31345e911c73e7247d16efe4e /activemodel/test | |
parent | 4de977117f5d7123aa97ab3837cc96ec19c68d33 (diff) | |
parent | 2cef2d411a20b89b71fb76876c33b331f94d0cc5 (diff) | |
download | rails-ceaf73a503814d000167503888a62c1a393730d4.tar.gz rails-ceaf73a503814d000167503888a62c1a393730d4.tar.bz2 rails-ceaf73a503814d000167503888a62c1a393730d4.zip |
Merge pull request #492 from jaw6/master
Serialized methods that return nil should not be considered YAML
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/serializers/xml_serialization_test.rb | 4 | ||||
-rw-r--r-- | activemodel/test/models/contact.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/test/cases/serializers/xml_serialization_test.rb b/activemodel/test/cases/serializers/xml_serialization_test.rb index b6a2f88667..8f5c196850 100644 --- a/activemodel/test/cases/serializers/xml_serialization_test.rb +++ b/activemodel/test/cases/serializers/xml_serialization_test.rb @@ -92,6 +92,10 @@ 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 test "should serialize integer" do assert_match %r{<age type="integer">25</age>}, @contact.to_xml diff --git a/activemodel/test/models/contact.rb b/activemodel/test/models/contact.rb index f4f3078473..7bfc542afb 100644 --- a/activemodel/test/models/contact.rb +++ b/activemodel/test/models/contact.rb @@ -16,6 +16,10 @@ class Contact options.each { |name, value| send("#{name}=", value) } end + def pseudonyms + nil + end + def persisted? id end |