mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix fraction float assertions in time_ext_test
These failed previously because decimals floats don't make perfect decimal numbers and Rational represents them exactly (either as decimal or the inexact float value). This changes the asserts to match that value.
This commit is contained in:
parent
d96a715859
commit
4484db4094
1 changed files with 2 additions and 2 deletions
|
@ -114,13 +114,13 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
|
|||
assert_equal Rational(1, 1_000_000_000), 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
|
||||
assert_equal 0.000_000_001.to_r, 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.001)
|
||||
assert_equal Rational(1, 1_000_000_000), time.sec_fraction
|
||||
assert_equal 0.001.to_r / 1000000, time.sec_fraction
|
||||
end
|
||||
|
||||
def test_beginning_of_day
|
||||
|
|
Loading…
Reference in a new issue