aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-04-27 16:45:26 -0400
committerJosé Valim <jose.valim@gmail.com>2010-04-29 09:04:34 +0200
commit580dd3b052e471aa680b80c0e1d8ebe7bd7a3831 (patch)
tree4e10d448aff1b744346cccf62ce08a793de2d931 /activemodel
parent1b816d502444ce2b3153d8c689d0057f1c257eee (diff)
downloadrails-580dd3b052e471aa680b80c0e1d8ebe7bd7a3831.tar.gz
rails-580dd3b052e471aa680b80c0e1d8ebe7bd7a3831.tar.bz2
rails-580dd3b052e471aa680b80c0e1d8ebe7bd7a3831.zip
array.to_xml should be able to handle all types of data elements [#4490 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/test/cases/serializeration/xml_serialization_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activemodel/test/cases/serializeration/xml_serialization_test.rb b/activemodel/test/cases/serializeration/xml_serialization_test.rb
index 6340aad531..ac8665d613 100644
--- a/activemodel/test/cases/serializeration/xml_serialization_test.rb
+++ b/activemodel/test/cases/serializeration/xml_serialization_test.rb
@@ -1,6 +1,7 @@
require 'cases/helper'
require 'models/contact'
require 'active_support/core_ext/object/instance_variables'
+require 'ostruct'
class Contact
extend ActiveModel::Naming
@@ -23,7 +24,9 @@ class XmlSerializationTest < ActiveModel::TestCase
@contact.age = 25
@contact.created_at = Time.utc(2006, 8, 1)
@contact.awesome = false
- @contact.preferences = { :gem => 'ruby' }
+ customer = OpenStruct.new
+ customer.name = "John"
+ @contact.preferences = customer
end
test "should serialize default root" do
@@ -93,7 +96,7 @@ class XmlSerializationTest < ActiveModel::TestCase
end
test "should serialize yaml" do
- assert_match %r{<preferences type=\"yaml\">--- \n:gem: ruby\n</preferences>}, @contact.to_xml
+ assert_match %r{<preferences type=\"yaml\">--- !ruby/object:OpenStruct \ntable:\s*:name: John\n</preferences>}, @contact.to_xml
end
test "should call proc on object" do