summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-01-29 09:38:01 +0000
committerSteve Kemp <steve@steve.org.uk>2015-01-29 09:38:01 +0000
commitdf5431fc32b2f86ac4c12ef086b747793556f8a1 (patch)
treef94cab3e7c38cd213f32f25a47fe9eaa5d0a690b
parent92a7254c4fb523c9b7737e02d4303f3101a9f410 (diff)
Added simple test cases
-rwxr-xr-xt/test-custodian-queue.rb84
1 files changed, 84 insertions, 0 deletions
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