aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-27 15:32:20 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-27 15:32:20 +0100
commit5e6f40f199adfcf5815b72d8450e1ca04579b368 (patch)
treea0533ac63aaa1d98d15853d022409e72271cfba5
parentdada535a41cba45be0eff77381d6c7e19ab49f51 (diff)
Fixed notification when on holiday/off sick
-rw-r--r--debian/changelog6
-rw-r--r--lib/mauve/configuration_builders/person.rb10
-rw-r--r--test/tc_mauve_configuration_builders_person.rb27
3 files changed, 36 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index f41e76e..b02e310 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mauvealert (3.8.3) stable; urgency=low
+
+ * Fixed notification when on holiday/off sick
+
+ -- Patrick J Cherry <patrick@bytemark.co.uk> Fri, 27 Apr 2012 15:32:07 +0100
+
mauvealert (3.8.2) stable; urgency=low
* Reverted bad changes to mauveserver + example.conf
diff --git a/lib/mauve/configuration_builders/person.rb b/lib/mauve/configuration_builders/person.rb
index afb967b..5c79474 100644
--- a/lib/mauve/configuration_builders/person.rb
+++ b/lib/mauve/configuration_builders/person.rb
@@ -57,6 +57,16 @@ module Mauve
end
end
+ #
+ #
+ def notify_when_on_holday!
+ result.notify_when_on_holiday!
+ end
+
+ def notify_when_off_sick!
+ result.notify_when_off_sick!
+ end
+
end
end
diff --git a/test/tc_mauve_configuration_builders_person.rb b/test/tc_mauve_configuration_builders_person.rb
index 6ee3d13..48ceafd 100644
--- a/test/tc_mauve_configuration_builders_person.rb
+++ b/test/tc_mauve_configuration_builders_person.rb
@@ -10,10 +10,16 @@ class TcMauveConfigurationBuildersPerson < Mauve::UnitTest
config=<<EOF
person("test1") {
all { "this should email on every level" }
+
email "test1@example.com"
sms "01234567890"
xmpp "test1@chat.example.com"
+
password "topsekrit"
+
+ notify_when_on_holday!
+ notify_when_off_sick!
+
notify {
during { "this is the during block" }
every 300
@@ -25,18 +31,22 @@ EOF
assert_nothing_raised { x = Mauve::ConfigurationBuilder.parse(config) }
assert_equal(1, x.people.length)
assert_equal(%w(test1), x.people.keys)
- assert_equal("test1@example.com", x.people["test1"].email)
- assert_equal("01234567890", x.people["test1"].sms)
- assert_equal("test1@chat.example.com", x.people["test1"].xmpp)
- assert_equal("topsekrit", x.people["test1"].password)
+
+ person = x.people["test1"]
+ assert_equal("test1@example.com", person.email)
+ assert_equal("01234567890", person.sms)
+ assert_equal("test1@chat.example.com", person.xmpp)
+ assert_equal("topsekrit", person.password)
# assert_equal(300, x.people["test1"].every)
# assert_equal("this is the during block", x.people["test1"].during.call)
#
- assert_equal("this should email on every level", x.people["test1"].urgent.call)
- assert_equal("this should email on every level", x.people["test1"].normal.call)
- assert_equal("this should email on every level", x.people["test1"].low.call)
+ assert_equal("this should email on every level", person.urgent.call)
+ assert_equal("this should email on every level", person.normal.call)
+ assert_equal("this should email on every level", person.low.call)
+ assert(person.notify_when_on_holiday)
+ assert(person.notify_when_off_sick)
end
def test_default_settings
@@ -61,6 +71,9 @@ EOF
assert_kind_of(Array, person.notifications)
assert_equal(1, person.notifications.length)
+
+ assert(!person.notify_when_on_holiday)
+ assert(!person.notify_when_off_sick)
end
end