Sha256: 484a1ffe9de0a49672350c4b3e2cadbea85eb7203f25e7f3cef0465718d2ed44

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
class DaemonTest < Test::Unit::TestCase
  context "a daemon" do
    setup do
      @server = stub('Server')
      @waiting_queue = stub('Queue(waiting)')
      @waiting_queue.stubs(:receive)
      @error_queue = stub('Queue(error)')
      @done_queue = stub('Queue(done)')
    end
    should "be startable" do
      assert_nothing_raised do
        daemon = Refinery::Daemon.new(@server, 'sample', @waiting_queue, @error_queue, @done_queue)
      end
    end
    should "have logging" do
      daemon = Refinery::Daemon.new(@server, 'sample', @waiting_queue, @error_queue, @done_queue)
      assert_not_nil daemon.logger
    end
    should "allow visibility setting" do
      @waiting_queue.stubs(:receive).with({'visibility' => 600})
      daemon = Refinery::Daemon.new(@server, 'sample', @waiting_queue, @error_queue, @done_queue, {'visibility' => 600})
    end
    context "that is started" do
      setup do
        @daemon = Refinery::Daemon.new(@server, 'sample', @waiting_queue, @error_queue, @done_queue)
      end
      should "have a state of running" do
        assert @daemon.running?
      end
      context "after calling stop" do
        setup do
          @daemon.stop
        end
        should "not be running" do
          assert !@daemon.running?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
aeden-refinery-0.9.5 test/unit/daemon_test.rb
refinery-0.9.5 test/unit/daemon_test.rb