require 'test/unit' require 'marjoree/time' class TestTime < Test::Unit::TestCase def test_secs assert_equal 10, 10.secs assert_equal 1, 1.sec end def test_mins assert_equal 60, 1.min assert_equal 300, 5.mins end def test_hours assert_equal 3600, 1.hour assert_equal 36000, 10.hours end def test_ago tolerance = 1.sec expected = Time.new - 3600 assert (expected - 1.hour.ago).abs < tolerance end end