/vendor/gems/facets-2.4.5/test/core/time/test_trunc.rb
Ruby | 31 lines | 19 code | 9 blank | 3 comment | 0 complexity | bf809d003abc8e17c7fb730cef8c850d MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- require 'facets/time/trunc'
- require 'test/unit'
- class Test_Time_Trunc < Test::Unit::TestCase
- def setup
- @t = Time.local(2000,03,03,3,37,23)
- end
- def test_trunc_hour
- assert_equal Time.local(2000,03,03,3, 0), @t.trunc(60 * 60)
- end
- #def test_trunc_month
- # assert_equal Time.local(2000,03,01,0, 0), @t.trunc( 1.month )
- #end
- def test_trunc_15_minutes
- assert_equal Time.local(2000,03,03,3,30), @t.trunc(15 * 60)
- end
-
- def test_trunc_10_minutes
- assert_equal Time.local(2000,03,03,3,30), @t.trunc(10 * 60)
- end
- def test_trunc_05_minutes
- assert_equal Time.local(2000,03,03,3,35), @t.trunc( 5 * 60)
- end
- end