aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorJohn Firebaugh <john_firebaugh@us.ibm.com>2011-01-06 13:26:31 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-03 13:11:56 -0200
commitbf0395837fc735bf98daed23f475b267e48c1118 (patch)
tree7c4ba5388501c0f5257e66799ce4d118daea92cd /activesupport/test/core_ext
parentc1c6f29214d3c280f5d1d4abb49d0b90424fcbd7 (diff)
downloadrails-bf0395837fc735bf98daed23f475b267e48c1118.tar.gz
rails-bf0395837fc735bf98daed23f475b267e48c1118.tar.bz2
rails-bf0395837fc735bf98daed23f475b267e48c1118.zip
Preserve fractional seconds in DateTime#to_time
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index 7d993d84e2..8edb95b63a 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -38,6 +38,8 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase
assert_equal Time.utc_time(2039, 2, 21, 10, 11, 12), DateTime.new(2039, 2, 21, 10, 11, 12, 0, 0).to_time
# DateTimes with offsets other than 0 are returned unaltered
assert_equal DateTime.new(2005, 2, 21, 10, 11, 12, Rational(-5, 24)), DateTime.new(2005, 2, 21, 10, 11, 12, Rational(-5, 24)).to_time
+ # Fractional seconds are preserved
+ assert_equal Time.utc(2005, 2, 21, 10, 11, 12, 256), DateTime.new(2005, 2, 21, 10, 11, 12 + Rational(256, 1000000), 0).to_time
end
def test_civil_from_format