提交 bdb2871d 编写于 作者: A Anil Wadghule 提交者: José Valim

Fix xml serialization test [#4650 state:resolved]

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 5573ab20
......@@ -17,6 +17,9 @@ class Contact < ::Contact
end
end
class Customer < Struct.new(:name)
end
class XmlSerializationTest < ActiveModel::TestCase
def setup
@contact = Contact.new
......@@ -24,7 +27,7 @@ def setup
@contact.age = 25
@contact.created_at = Time.utc(2006, 8, 1)
@contact.awesome = false
customer = OpenStruct.new
customer = Customer.new
customer.name = "John"
@contact.preferences = customer
end
......@@ -104,7 +107,7 @@ def setup
end
test "should serialize yaml" do
assert_match %r{<preferences type=\"yaml\">--- !ruby/object:OpenStruct \ntable:\s*:name: John\n</preferences>}, @contact.to_xml
assert_match %r{<preferences type=\"yaml\">--- !ruby/struct:Customer \nname: John\n</preferences>}, @contact.to_xml
end
test "should call proc on object" do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册