test/test_workpattern.rb in workpattern-0.3.2 vs test/test_workpattern.rb in workpattern-0.3.3

- old
+ new

@@ -1,14 +1,14 @@ require File.dirname(__FILE__) + '/test_helper.rb' -class TestWorkpattern < Test::Unit::TestCase #:nodoc: +class TestWorkpattern < MiniTest::Unit::TestCase #:nodoc: def setup Workpattern.clear() end - must "create a working workpattern" do + def test_must_create_a_working_workpattern name='mywp' base=2001 span=11 wp=Workpattern.new(name,base,span) assert_equal name, wp.name @@ -16,11 +16,11 @@ assert_equal span, wp.span assert_equal DateTime.new(base), wp.from assert_equal DateTime.new(base+span-1,12,31,23,59), wp.to end - must "set patterns correctly" do + def test_must_set_patterns_correctly name='mypattern' base=2000 span=11 wp=Workpattern.new(name,base,span) @@ -46,11 +46,11 @@ wp.workpattern(:days=>:weekend,:from_time=>clock(0,0),:to_time=>clock(23,59),:work_type=>0) assert_equal 7200, get_week(wp.weeks).week_total end - must 'add minutes in a working workpattern' do + def test_must_add_minutes_in_a_working_workpattern name='mypattern' base=1999 span=11 wp=Workpattern.new(name,base,span) tests=[[2000,1,1,0,0,3,2000,1,1,0,3], @@ -64,11 +64,11 @@ ] clue="add minutes in a working workpattern" calc_test(wp,tests,clue) end - must 'add minutes in a resting workpattern' do + def test_must_add_minutes_in_a_resting_workpattern name='mypattern' base=1999 span=11 wp=Workpattern.new(name,base,span) start=DateTime.new(1999,6,11,0,0) @@ -85,15 +85,15 @@ ] clue="add minutes in a resting workpattern" calc_test(wp,tests,clue) end - must 'add minutes in a patterned workpattern' do + def test_must_add_minutes_in_a_patterned_workpattern assert true end - must 'subtract minutes in a working workpattern' do + def test_must_subtract_minutes_in_a_working_workpattern name='mypattern' base=1999 span=11 wp=Workpattern.new(name,base,span) tests=[[2000,1,1,0,0,-3,1999,12,31,23,57], @@ -107,11 +107,11 @@ ] clue="subtract minutes in a working workpattern" calc_test(wp,tests,clue) end - must 'subtract minutes in a resting workpattern' do + def test_must_subtract_minutes_in_a_resting_workpattern name='mypattern' base=1999 span=11 wp=Workpattern.new(name,base,span) start=DateTime.new(1999,6,11,0,0) @@ -128,16 +128,16 @@ ] clue="subtract minutes in a resting workpattern" calc_test(wp,tests,clue) end - must 'subtract minutes in a patterned workpattern' do + def test_must_subtract_minutes_in_a_patterned_workpattern assert true end - must "calculate difference between dates in working calender" do + def test_must_calculate_difference_between_dates_in_working_calender name='mypattern' base=1999 span=40 wp=Workpattern.new(name,base,span) @@ -165,30 +165,30 @@ duration, result_date=wp.diff(start,finish) assert_equal result, duration,"duration diff(#{start}, #{finish})" } end - must "calculate difference between minutes in resting workpattern" do + def test_must_calculate_difference_between_minutes_in_resting_workpattern assert true end - must "calculate difference between minutes in pattern workpattern" do + def test_must_calculate_difference_between_minutes_in_pattern_workpattern assert true end - must "follow the example in workpattern" do + def test_must_follow_the_example_in_workpattern mywp=Workpattern.new('My Workpattern',2011,10) mywp.resting(:days => :weekend) mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(0,0),:to_time=>Workpattern.clock(8,59)) mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(12,0),:to_time=>Workpattern.clock(12,59)) mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(18,0),:to_time=>Workpattern.clock(23,59)) mydate=DateTime.civil(2011,9,1,9,0) result_date = mywp.calc(mydate,1920) # => 6/9/11@18:00 assert_equal DateTime.civil(2011,9,6,18,0), result_date, 'example in workpattern' end - must "calculate across week patterns" do + def test_must_calculate_across_week_patterns name='mypattern' base=2011 span=11 wp=Workpattern.new(name,base,span) start=DateTime.new(2012,9,24,0,0) @@ -226,10 +226,10 @@ ] clue="calculate across week patterns" calc_test(wp,tests,clue) end - must "know whether a time is working or resting" do + def test_must_know_whether_a_time_is_working_or_resting name='working?' base=2011 span=11 wp=Workpattern.new(name,base,span) wp.resting(:to_time=>Workpattern.clock(8,59))