Sha256: 7e0510f4e7f90d2c3b25e531121e66eba174e66b0de0f6ffbeaa816b33d703ef
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' require 'resque_rate_limited_queue' class RateLimitDuration def self.seconds 60 end end class RateLimitedTestQueueEn def self.perform(succeed) raise(Evernote::EDAM::Error::EDAMSystemException, rateLimitDuration: RateLimitDuration) unless succeed end end describe Resque::Plugins::RateLimitedQueue::EvernoteQueue do describe 'enqueue' do it 'enqueues to the correct queue with the correct parameters' do Resque.should_receive(:enqueue_to).with( :evernote_api, Resque::Plugins::RateLimitedQueue::EvernoteQueue, RateLimitedTestQueueEn.to_s, true) Resque::Plugins::RateLimitedQueue::EvernoteQueue .enqueue(RateLimitedTestQueueEn, 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 RateLimitedTestQueueEn.should_receive(:perform).with('test_param') Resque::Plugins::RateLimitedQueue::EvernoteQueue .enqueue(RateLimitedTestQueueEn, 'test_param') end end context 'with rate limit exception' do before do Resque::Plugins::RateLimitedQueue::EvernoteQueue.stub(:rate_limited_requeue) end it 'pauses queue when request fails' do Resque::Plugins::RateLimitedQueue::EvernoteQueue.should_receive(:pause_for) Resque::Plugins::RateLimitedQueue::EvernoteQueue .enqueue(RateLimitedTestQueueEn, 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/evernote_queue_spec.rb |
resque-rate_limited_queue-0.0.30 | spec/apis/evernote_queue_spec.rb |