From 5e4cbcbf100de85981dc8318059aeec7e3f2a5b5 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 29 Jan 2015 09:38:01 +0000 Subject: Added simple test cases --- t/test-custodian-queue.rb | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 t/test-custodian-queue.rb diff --git a/t/test-custodian-queue.rb b/t/test-custodian-queue.rb new file mode 100755 index 0000000..7e5d0d9 --- /dev/null +++ b/t/test-custodian-queue.rb @@ -0,0 +1,84 @@ +#!/usr/bin/ruby -I./lib/ -I../lib/ + + +require 'test/unit' +require 'custodian/queue' + + + + +# +# Unit test for our queue-factory. +# +class TestCustodianQueue < Test::Unit::TestCase + + + + + # + # Create the test suite environment: NOP. + # + def setup + end + + + + + # + # Destroy the test suite environment: NOP. + # + def teardown + end + + + + + # + # Test that creating an unknown type throws an exception. + # + def test_unknown + + # creation will fail + assert_raise RuntimeError do + t = Custodian::QueueType.create( "foo" ) + end + + end + + + + def test_redis + q = nil + assert_nothing_raised do + q = Custodian::QueueType.create( "redis" ) + end + + # + # here we're testing we've got a derived class that has + # implemented "def size?" + # + assert_nothing_raised do + q.size? + end + + end + + + def test_beanstalkd + q = nil + assert_nothing_raised do + q = Custodian::QueueType.create( "redis" ) + end + + # + # here we're testing we've got a derived class that has + # implemented "def size?" + # + assert_nothing_raised do + q.size? + end + + + end + +end -- cgit v1.2.1