Sha256: fa63f1ed16c380d737ad5c6a9b2d906d5c67b83c106da15a9d3b27618ad95797
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require '../test_helper.rb' class ResqueTest < Test::Unit::TestCase context "Resque" do setup do Resque.redis.flush_all assert_nil Resque.redis.get(OneHourThrottledJob.key) @bogus_args = [1, 2] end context "#enqueue" do should "add a throttled job key to the set with the proper TTL (Expire)" do Resque.expects(:enqueue_without_throttle).returns(true) assert Resque.enqueue(OneHourThrottledJob, @bogus_args) assert Resque.redis.get(OneHourThrottledJob.key) assert_equal 3600, Resque.redis.ttl(OneHourThrottledJob.key) end context "job has not reached throttle limit" do should "not add another job to the queue and raise a throttled exception" do Resque.expects(:enqueue_without_throttle).once assert_raises(Resque::ThrottledError) { 2.times { Resque.enqueue(OneHourThrottledJob, @bogus_args) } } end end should "enqueue a job without throttling if the job is disabled" do Resque.expects(:enqueue_without_throttle).twice 2.times { Resque.enqueue(DisabledThrottledJob, @bogus_args) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
resque-throttle-0.2.2 | test/resque/resque_test.rb |
resque-throttle-0.2.1 | test/resque/resque_test.rb |
resque-throttle-0.2.0 | test/resque/resque_test.rb |