Sha256: f2e81246d447c791156743ffb2f377d619bddba3bbb079ce9540d0496ea9de94

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path('../test_helper', __FILE__)

module Larva
  class WorkerPoolTest < Minitest::Test
    def test_should_complete_for_no_processors
      WorkerPool.start({})
    end

    def test_process_logs_start_message
      Propono.config.logger.stubs(:info)
      Propono.config.logger.expects(:info).with("Starting threads.")
      WorkerPool.start({})
    end

    def test_process_logs_end_message
      Propono.config.logger.stubs(:info)
      Propono.config.logger.expects(:info).with("Threads Started.")
      WorkerPool.start({})
    end

    def test_start_worker_logs_exception
      Larva::Listener.expects(:listen).raises(RuntimeError)
      Propono.config.logger.expects(:error).with do |error|
        error.start_with?("Unexpected listener termination:")
      end
      Propono.config.logger.expects(:error).with('Some threads have died')
      WorkerPool.start({nil => nil})
    end

    def test_listen_is_called_correctly
      topic_name = "Foo"
      processor = mock
      Larva::Listener.expects(:listen).with(topic_name, processor)
      WorkerPool.start({topic_name => processor})
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
larva-0.6.4 test/worker_pool_test.rb
larva-0.6.3 test/worker_pool_test.rb
larva-0.6.2 test/worker_pool_test.rb
larva-0.6.1 test/worker_pool_test.rb
larva-0.6.0 test/worker_pool_test.rb
larva-0.5.0 test/worker_pool_test.rb