aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorJason Weathered <jason@jasoncodes.com>2011-04-17 21:10:02 +1000
committerJason Weathered <jason@jasoncodes.com>2011-04-17 21:10:02 +1000
commit96546bb63bd5f1b24f5126e7a3314580bc59584f (patch)
treee826c9edd2f5ae340bcf274a6c89600c07428a8f /activesupport/test/core_ext/time_ext_test.rb
parentb6843f22ac42b503f6b8ac00105ca0679049be7d (diff)
downloadrails-96546bb63bd5f1b24f5126e7a3314580bc59584f.tar.gz
rails-96546bb63bd5f1b24f5126e7a3314580bc59584f.tar.bz2
rails-96546bb63bd5f1b24f5126e7a3314580bc59584f.zip
Fix marshal round-tripping of fractional seconds (Time#subsec).
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 53d497013a..44e02109b1 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -808,4 +808,11 @@ class TimeExtMarshalingTest < Test::Unit::TestCase
assert_equal t.zone, unmarshaled.zone
assert_equal t, unmarshaled
end
+
+ def test_marshalling_preserves_fractional_seconds
+ t = Time.parse('00:00:00.500')
+ unmarshaled = Marshal.load(Marshal.dump(t))
+ assert_equal t.to_f, unmarshaled.to_f
+ assert_equal t, unmarshaled
+ end
end