summaryrefslogtreecommitdiff
path: root/t/test-custodian-alertfactory.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-02-25 17:01:42 +0000
committerSteve Kemp <steve@steve.org.uk>2013-02-25 17:01:42 +0000
commit7b290e456072cdf81b02c2a2143c6e240e54628d (patch)
treeac1b4a50d981f7ba32673dc67dbf6f30a2f31a04 /t/test-custodian-alertfactory.rb
parent024700bb559bd9b33662d55189c310b4be9bdc69 (diff)
Loading mauve/redis is optional. The test suite will skip them if not
present.
Diffstat (limited to 't/test-custodian-alertfactory.rb')
-rwxr-xr-xt/test-custodian-alertfactory.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/t/test-custodian-alertfactory.rb b/t/test-custodian-alertfactory.rb
index cbc6777..f81a763 100755
--- a/t/test-custodian-alertfactory.rb
+++ b/t/test-custodian-alertfactory.rb
@@ -30,7 +30,34 @@ class TestAlertFactory < Test::Unit::TestCase
#
# Ensure we can create each of the two alert types we care about
#
- %w( file mauve redis smtp ).each do |name|
+ methods = Array.new()
+ methods.push( "file" )
+ methods.push( "smtp" )
+
+ #
+ # Mauve + Redis are optional
+ #
+ redis = true
+ mauve = true
+
+ begin
+ require 'rubygems'
+ require 'redis'
+ rescue LoadError => ex
+ redis = false
+ end
+
+ begin
+ require 'mauve/sender'
+ require 'mauve/proto'
+ rescue LoadError => ex
+ mauve = false
+ end
+
+ methods.push( "redis" ) if ( redis )
+ methods.push( "mauve" ) if ( mauve )
+
+ methods.each do |name|
#
# Use the factory to instantiate the correct object.