aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash_ext_test.rb
diff options
context:
space:
mode:
authorJonathan del Strother <jon.delStrother@bestbefore.tv>2009-03-12 17:53:16 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-12 18:35:49 +0000
commit923067810480c93817dbae3d8295a18aa2a2ec3a (patch)
tree868dcb935c46cb8d5b822af654038b4beb9b0404 /activesupport/test/core_ext/hash_ext_test.rb
parentd771e7d17f4a2c175676f7c8354aa5b161b63c2e (diff)
downloadrails-923067810480c93817dbae3d8295a18aa2a2ec3a.tar.gz
rails-923067810480c93817dbae3d8295a18aa2a2ec3a.tar.bz2
rails-923067810480c93817dbae3d8295a18aa2a2ec3a.zip
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 <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/test/core_ext/hash_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb9
1 files changed, 9 insertions, 0 deletions
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?(%(<addresses type="array"><address><streets type="array"><street><name>))
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{<created-at type=\"datetime\">1999-02-02T00:00:00Z</created-at>}, xml
+ assert_match %r{<local-created-at type=\"datetime\">1999-02-01T19:00:00-05:00</local-created-at>}, xml
+ end
+
def test_single_record_from_xml
topic_xml = <<-EOT
<topic>