Skip to content

Commit

Permalink
Fix xml serialization test [rails#4650 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
anildigital authored and josevalim committed May 19, 2010
1 parent 5573ab2 commit bdb2871
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -17,14 +17,17 @@ class Contact < ::Contact
end
end

class Customer < Struct.new(:name)
end

class XmlSerializationTest < ActiveModel::TestCase
def setup
@contact = Contact.new
@contact.name = 'aaron stack'
@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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bdb2871

Please sign in to comment.