Sha256: 21c0928a28bec57820450f8ddd7027123df2c628716e384aafcc15effaa47f2c

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class ResqueTest < Test::Unit::TestCase

  context "Resque" do
    setup do
      Resque.redis.flushall
      @bogus_args = "bogus_arg"
    end

    context "#enqueue" do

      context "the queue is not empty" do
        setup do
          Resque.enqueue(QueuedJob, @bogus_args)
        end

        should "not add another job to the queue and raise an exception" do
          assert_raises(Resque::EmptyQueueError) { Resque.enqueue(DefaultEmptyQueueJob, @bogus_args) }
        end
      end

      context "the queue is empty" do
        should "raise an exception on a duplicate indentifier" do
          Resque.expects(:enqueue_without_empty_queue).once
          Resque.enqueue(DefaultEmptyQueueJob, @bogus_args)
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resque_empty_queue-0.0.3 test/resque/resque_test.rb
resque_empty_queue-0.0.2 test/resque/resque_test.rb
resque_empty_queue-0.0.1 test/resque/resque_test.rb