| Class | TimeExTest |
| In: |
lib/core_ex/time.rb
|
| Parent: | Test::Unit::TestCase |
# File lib/core_ex/time.rb, line 40 def setup @t1, @t2 = Time.at(1125583814.373), Time.at(1125583801.445) end
# File lib/core_ex/time.rb, line 48 def test_minus d1 = @t1 - @t2 assert_kind_of(DTime, d1) assert_kind_of(Time, Time.now - d1) assert_kind_of(Time, Time.now - 1.4) assert_kind_of(Time, Time.now - 4) assert_equal(@t1, @t1 - 0) assert_equal(@t1, @t1 - 0.0) assert_equal(0, (@t1 - @t1).to_f) end
# File lib/core_ex/time.rb, line 59 def test_minus_2 t = Time.utc(1937, 1, 1, 11, 40, 27, 870000) s = "1937-01-01T12:00:27.87+00:20" assert_equal(0, (t - Time.iso8601(s)).to_f) end