mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
3124007bd6
commit
d96a715859
1 changed files with 8 additions and 8 deletions
|
@ -110,17 +110,17 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sec_fraction
|
def test_sec_fraction
|
||||||
time = Time.utc(2016, 4, 23, 0, 0, Rational(1, 10000000000))
|
time = Time.utc(2016, 4, 23, 0, 0, Rational(1, 1_000_000_000))
|
||||||
assert_equal Rational(1, 10000000000), time.sec_fraction
|
assert_equal Rational(1, 1_000_000_000), time.sec_fraction
|
||||||
|
|
||||||
time = Time.utc(2016, 4, 23, 0, 0, 0.0000000001)
|
time = Time.utc(2016, 4, 23, 0, 0, 0.000_000_001)
|
||||||
assert_equal 0.0000000001.to_r, time.sec_fraction
|
assert_equal Rational(1, 1_000_000_000), time.sec_fraction
|
||||||
|
|
||||||
time = Time.utc(2016, 4, 23, 0, 0, 0, Rational(1, 10000))
|
time = Time.utc(2016, 4, 23, 0, 0, 0, Rational(1, 1_000))
|
||||||
assert_equal Rational(1, 10000000000), time.sec_fraction
|
assert_equal Rational(1, 1_000_000_000), time.sec_fraction
|
||||||
|
|
||||||
time = Time.utc(2016, 4, 23, 0, 0, 0, 0.0001)
|
time = Time.utc(2016, 4, 23, 0, 0, 0, 0.001)
|
||||||
assert_equal 0.0001.to_r / 1000000, time.sec_fraction
|
assert_equal Rational(1, 1_000_000_000), time.sec_fraction
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_beginning_of_day
|
def test_beginning_of_day
|
||||||
|
|
Loading…
Reference in a new issue