Sha256: 61d99dba215e1c37cd1f13c21ccdb5410d3f3930ff39ec6517e63f7f6659de9f
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' require 'resque_rate_limited_queue' class RateLimitedTestQueueAL def self.perform(succeed) raise(AngellistApi::Error::TooManyRequests, 'error') unless succeed end end describe Resque::Plugins::RateLimitedQueue::AngellistQueue do describe 'enqueue' do it 'enqueues to the correct queue with the correct parameters' do Resque.should_receive(:enqueue_to).with( :angellist_api, Resque::Plugins::RateLimitedQueue::AngellistQueue, RateLimitedTestQueueAL.to_s, true) Resque::Plugins::RateLimitedQueue::AngellistQueue .enqueue(RateLimitedTestQueueAL, true) end end describe 'perform' do before do Resque.inline = true end context 'with everything' do it 'calls the class with the right parameters' do RateLimitedTestQueueAL.should_receive(:perform).with('test_param') Resque::Plugins::RateLimitedQueue::AngellistQueue .enqueue(RateLimitedTestQueueAL, 'test_param') end end context 'with rate limit exception' do before do Resque::Plugins::RateLimitedQueue::AngellistQueue.stub(:rate_limited_requeue) end it 'pauses queue when request fails' do Resque::Plugins::RateLimitedQueue::AngellistQueue.should_receive(:pause_for) Resque::Plugins::RateLimitedQueue::AngellistQueue .enqueue(RateLimitedTestQueueAL, false) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resque-rate_limited_queue-0.0.31 | spec/apis/angellist_queue_spec.rb |
resque-rate_limited_queue-0.0.30 | spec/apis/angellist_queue_spec.rb |