aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_time_ext_test.rb
diff options
context:
space:
mode:
authorJohn Paul Ashenfelter <johnpaul@transitionpoint.com>2014-07-01 09:43:46 -0400
committerGodfrey Chan <godfreykfc@gmail.com>2014-07-02 15:01:35 -0700
commitd75992b0b22b656d16a28c04eac771a93486f465 (patch)
tree94f8360a188fe2b6aae286d0962913efb3f3ddc8 /activesupport/test/core_ext/date_time_ext_test.rb
parenta4104278b5cc5a7e7b15473c1ea74125f915f2db (diff)
downloadrails-d75992b0b22b656d16a28c04eac771a93486f465.tar.gz
rails-d75992b0b22b656d16a28c04eac771a93486f465.tar.bz2
rails-d75992b0b22b656d16a28c04eac771a93486f465.zip
`DateTime#to_f` now preserves fractional seconds.
Previously this method always returns `.0` in the fractional part. This commit changes it to preserve the fractional seconds instead. Fixes #15994.
Diffstat (limited to 'activesupport/test/core_ext/date_time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb1
1 files changed, 1 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 2c08b46791..74319ecd09 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -338,6 +338,7 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase
def test_to_f
assert_equal 946684800.0, DateTime.civil(2000).to_f
assert_equal 946684800.0, DateTime.civil(1999,12,31,19,0,0,Rational(-5,24)).to_f
+ assert_equal 946684800.5, DateTime.civil(1999,12,31,19,0,0.5,Rational(-5,24)).to_f
end
def test_to_i