From 923067810480c93817dbae3d8295a18aa2a2ec3a Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Thu, 12 Mar 2009 17:53:16 +0000 Subject: Use xmlschema when serializing TimeWithZones to xml [#2223 state:resolved] When using Hash#to_xml, any TimeWithZone objects now use xmlschema (iso8601), rather than a simple TimeWithZone#to_s. Signed-off-by: Pratik Naik --- activesupport/test/core_ext/hash_ext_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activesupport/test/core_ext/hash_ext_test.rb') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 482ae57830..0edac72fe7 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -497,6 +497,15 @@ class HashToXmlTest < Test::Unit::TestCase assert xml.include?(%(
)) end + def test_timezoned_attributes + xml = { + :created_at => Time.utc(1999,2,2), + :local_created_at => Time.utc(1999,2,2).in_time_zone('Eastern Time (US & Canada)') + }.to_xml(@xml_options) + assert_match %r{1999-02-02T00:00:00Z}, xml + assert_match %r{1999-02-01T19:00:00-05:00}, xml + end + def test_single_record_from_xml topic_xml = <<-EOT -- cgit v1.2.3