aboutsummaryrefslogtreecommitdiff
path: root/test/time_test.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-15 19:47:24 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-15 19:47:24 +0100
commitfc0327f91fb134e1df994143a78c22df7d8f62e4 (patch)
tree9fb1161dbdece4428e6c65b1d555a67c7908fa9e /test/time_test.rb
parent3576923edf788eecb4320e034f5afaaf625bd62e (diff)
Big interface clear up
Diffstat (limited to 'test/time_test.rb')
-rw-r--r--test/time_test.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/time_test.rb b/test/time_test.rb
new file mode 100644
index 0000000..0749fef
--- /dev/null
+++ b/test/time_test.rb
@@ -0,0 +1,43 @@
+$: << "../lib/"
+
+require 'test/unit'
+require 'mauve/mauve_time'
+require 'pp'
+
+class TestMauveTime < Test::Unit::TestCase
+
+ def test_in_x_hours
+
+ #
+ # 5pm on a Friday
+ #
+ t = Time.local(2011,6,3,17,14,32)
+
+ #
+ # Working hours..
+ #
+ hour_0 = Time.local(2011,6,6,8,30,0)
+ hour_1 = Time.local(2011,6,6,9,30,0)
+
+ assert_equal(hour_1, t.in_x_hours(1,"working"))
+ assert_equal(hour_0, t.in_x_hours(0,"working"))
+
+ #
+ # 4.45pm on a Friday
+ #
+ t = Time.local(2011,6,3,16,45,32)
+
+ #
+ # Working hours..
+ #
+ hour_0 = Time.local(2011,6,3,16,45,32)
+ hour_1 = Time.local(2011,6,6,9,15,32)
+
+ assert_equal(hour_1, t.in_x_hours(1,"working"))
+ assert_equal(hour_0, t.in_x_hours(0,"working"))
+
+
+ end
+
+
+end