From d96a71585957da21cf5e95d2276b1aa4aeab22ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 30 Sep 2019 18:18:03 -0400 Subject: [PATCH] Decrease the precision of the sec_fraction in the tests We were using picoseconds as precision but some Ruby implementations only support up to nanoseconds. Since that much precision was not needed to test the feature I decreased the precision. --- activesupport/test/core_ext/time_ext_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 41ab98e721..69f7e82585 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -110,17 +110,17 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase end def test_sec_fraction - time = Time.utc(2016, 4, 23, 0, 0, Rational(1, 10000000000)) - assert_equal Rational(1, 10000000000), time.sec_fraction + time = Time.utc(2016, 4, 23, 0, 0, Rational(1, 1_000_000_000)) + assert_equal Rational(1, 1_000_000_000), time.sec_fraction - time = Time.utc(2016, 4, 23, 0, 0, 0.0000000001) - assert_equal 0.0000000001.to_r, time.sec_fraction + time = Time.utc(2016, 4, 23, 0, 0, 0.000_000_001) + assert_equal Rational(1, 1_000_000_000), time.sec_fraction - time = Time.utc(2016, 4, 23, 0, 0, 0, Rational(1, 10000)) - assert_equal Rational(1, 10000000000), time.sec_fraction + time = Time.utc(2016, 4, 23, 0, 0, 0, Rational(1, 1_000)) + assert_equal Rational(1, 1_000_000_000), time.sec_fraction - time = Time.utc(2016, 4, 23, 0, 0, 0, 0.0001) - assert_equal 0.0001.to_r / 1000000, time.sec_fraction + time = Time.utc(2016, 4, 23, 0, 0, 0, 0.001) + assert_equal Rational(1, 1_000_000_000), time.sec_fraction end def test_beginning_of_day