Sha256: 357d8b2aac01e7de4c857dc4ccd09ad35d65a1bff13ddfb69f7c40974d8bc01b

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

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

class BBQueue::ConsumerTest < MiniTest::Test
  def test_job
    consumer = BBQueue::Consumer.new("default")

    assert_equal 3, Stalking::Consumer.instances.last.run_job("default", { "object" => BBQueue::Serializer.dump(BBQueue::TestJob.new(1, 2)) })
  end

  def test_error
    logger = BBQueue::TestLogger.new
    consumer = BBQueue::Consumer.new("default", :logger => logger)

    assert_difference "logger.count", 2 do
      Stalking::Consumer.instances.last.run_error("Error", "default", { "object" => BBQueue::Serializer.dump(BBQueue::TestJob.new(1, 2)) })
    end
  end

  def test_before
    logger = BBQueue::TestLogger.new
    consumer = BBQueue::Consumer.new("default", :logger => logger)

    assert_difference "logger.count" do
      Stalking::Consumer.instances.last.run_before("default", { "object" => BBQueue::Serializer.dump(BBQueue::TestJob.new(1, 2)) })
    end
  end

  def test_after
    logger = BBQueue::TestLogger.new
    consumer = BBQueue::Consumer.new("default", :logger => logger)

    assert_difference "logger.count" do
      Stalking::Consumer.instances.last.run_after("default", { "object" => BBQueue::Serializer.dump(BBQueue::TestJob.new(1, 2)) })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bbqueue-0.0.1 test/bbqueue/consumer_test.rb