Sha256: a55ca51653cbf68c8a18fcaf37a79a2eb414a32aee04982b93e504ceeb5b78e9

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestClock < Test::Unit::TestCase #:nodoc:

  def setup
  end
  
  must "create midnight default"  do
    clock=Workpattern::Clock.new()
    
    assert_equal 0, clock.minutes, "total default minutes"
    assert_equal 0, clock.hour, "default hour is zero"
    assert_equal 0, clock.min, "default minute is zero"
    time = clock.time
    assert time.kind_of?(DateTime), "must return a DateTime object"
    assert_equal 0, time.hour, "hour in the day must be zero"
    assert_equal 0, time.min, "minute in the day must be zero"
  end
  
  must "account for out of range values" do
    clock=Workpattern::Clock.new(27,80)
    
    assert_equal 1700, clock.minutes, "total minutes"
    assert_equal 4, clock.hour, "hour is 4"
    assert_equal 20, clock.min, "minute is 20"
    time = clock.time
    assert time.kind_of?(DateTime), "must return a DateTime object"
    assert_equal 4, time.hour, "hour in the day must be 4"
    assert_equal 20, time.min, "minute in the day must be 20"
  end
end  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workpattern-0.3.2 test/test_clock.rb
workpattern-0.3.1 test/test_clock.rb
workpattern-0.3.0 test/test_clock.rb
workpattern-0.2.0 test/test_clock.rb