aboutsummaryrefslogtreecommitdiff
path: root/test/tc_mauve_time.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-05-02 10:44:34 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-05-02 10:44:34 +0100
commit27d38820a67751a898d5d17073adc556c4bb56a9 (patch)
tree6157be1229f0c5ea7f8f237370ede914cf7e2f95 /test/tc_mauve_time.rb
parente6c1341540eb4c08b1cbfef46cf2360489b27bd0 (diff)
Added configuration options for daytime_hours, dead_zone, and working_hours.
Diffstat (limited to 'test/tc_mauve_time.rb')
-rw-r--r--test/tc_mauve_time.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/tc_mauve_time.rb b/test/tc_mauve_time.rb
index 6e5989b..66cb4f7 100644
--- a/test/tc_mauve_time.rb
+++ b/test/tc_mauve_time.rb
@@ -16,8 +16,8 @@ class TestMauveTime < Mauve::UnitTest
#
# Working hours..
#
- hour_0 = Time.local(2011,6,6,8,30,0)
- hour_1 = Time.local(2011,6,6,9,30,0)
+ hour_0 = Time.local(2011,6,6,9,0,0)
+ hour_1 = Time.local(2011,6,6,10,0,0)
assert_equal(hour_1, t.in_x_hours(1,"working"))
assert_equal(hour_0, t.in_x_hours(0,"working"))
@@ -31,7 +31,7 @@ class TestMauveTime < Mauve::UnitTest
# Working hours..
#
hour_0 = Time.local(2011,6,3,16,45,32)
- hour_1 = Time.local(2011,6,6,9,15,32)
+ hour_1 = Time.local(2011,6,6,9,45,32)
assert_equal(hour_1, t.in_x_hours(1,"working"))
assert_equal(hour_0, t.in_x_hours(0,"working"))
@@ -41,10 +41,25 @@ class TestMauveTime < Mauve::UnitTest
x = Time.now
assert(!x.bank_holiday?)
-
x.bank_holidays << Date.new(x.year, x.month, x.day)
assert(x.bank_holiday?)
end
+ def test_dead_zone?
+ x = Time.local(2012,5,2,4,30,0)
+ assert(x.dead_zone?)
+
+ x = Time.local(2012,5,2,9,30,0)
+ assert(!x.dead_zone?)
+ end
+
+ def test_daytime_hours
+ x = Time.local(2012,5,2,4,30,0)
+ assert(!x.daytime_hours?)
+
+ x = Time.local(2012,5,2,9,30,0)
+ assert(x.daytime_hours?)
+ end
+
end