PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/core/time/test_round.rb

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 31 lines | 19 code | 9 blank | 3 comment | 0 complexity | f8a41536d4b788f9be9aafb7aff5ad38 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/time/round'
  2. require 'test/unit'
  3. class Test_Time_Round < Test::Unit::TestCase
  4. def setup
  5. @t = Time.local(2000,03,03,3,37,23)
  6. end
  7. def test_round_hour
  8. assert_equal Time.local(2000,03,03,4, 0), @t.round(60 * 60)
  9. end
  10. #def test_round_month
  11. # assert_equal Time.local(2000,03,03,3, 0), @t.round( 1.month )
  12. #end
  13. def test_round_15_minutes
  14. assert_equal Time.local(2000,03,03,3,30), @t.round(15 * 60)
  15. end
  16. def test_round_10_minutes
  17. assert_equal Time.local(2000,03,03,3,40), @t.round(10 * 60)
  18. end
  19. def test_round_05_minutes
  20. assert_equal Time.local(2000,03,03,3,35), @t.round( 5 * 60)
  21. end
  22. end