summaryrefslogtreecommitdiff
path: root/t/test-custodian-queue.rb
blob: bcd615ce70904d7eb7eaa06907fbf028362f8c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/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 the methods "size?" & "flush!"
    #
    assert_nothing_raised do
      q.size?
      q.flush!
    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 the methods "size?" & "flush!"
    #
    assert_nothing_raised do
      q.size?
      q.flush!
    end


  end

end