diff options
author | Steve Kemp <steve@steve.org.uk> | 2013-02-25 17:01:42 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2013-02-25 17:01:42 +0000 |
commit | 33f21283a3e8dd3e7c0f6254b7a88beee940192f (patch) | |
tree | d9e31178b2742cdaef1483787320105aa3fe34f0 /t | |
parent | bdd05645109ae2d9575d0603c62cd3ca44f78a97 (diff) |
Loading mauve/redis is optional. The test suite will skip them if not
present.
Diffstat (limited to 't')
-rwxr-xr-x | t/test-custodian-alertfactory.rb | 29 |
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. |