From 7b290e456072cdf81b02c2a2143c6e240e54628d Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 25 Feb 2013 17:01:42 +0000 Subject: Loading mauve/redis is optional. The test suite will skip them if not present. --- t/test-custodian-alertfactory.rb | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 't') 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. -- cgit v1.2.1