diff options
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r-- | activemodel/test/cases/serializeration/xml_serialization_test.rb | 7 |
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 |