test/test_scheduled.rb in sidekiq-3.5.0 vs test/test_scheduled.rb in sidekiq-3.5.1

- old
+ new

@@ -8,15 +8,11 @@ end end describe 'poller' do before do - Sidekiq.redis = REDIS - Sidekiq.redis do |conn| - conn.flushdb - end - + Sidekiq.redis{|c| c.flushdb} @error_1 = { 'class' => ScheduledWorker.name, 'args' => [0], 'queue' => 'queue_1' } @error_2 = { 'class' => ScheduledWorker.name, 'args' => [1], 'queue' => 'queue_2' } @error_3 = { 'class' => ScheduledWorker.name, 'args' => [2], 'queue' => 'queue_3' } @future_1 = { 'class' => ScheduledWorker.name, 'args' => [3], 'queue' => 'queue_4' } @future_2 = { 'class' => ScheduledWorker.name, 'args' => [4], 'queue' => 'queue_5' } @@ -26,12 +22,12 @@ @scheduled = Sidekiq::ScheduledSet.new @poller = Sidekiq::Scheduled::Poller.new end class Stopper - def call(worker_class, message, queue, r) - yield if message['args'].first.odd? + def call(worker_class, job, queue, r) + yield if job['args'].first.odd? end end it 'executes client middleware' do Sidekiq.client_middleware.add Stopper @@ -41,15 +37,13 @@ @scheduled.schedule (Time.now - 60).to_f, @future_2 @scheduled.schedule (Time.now - 60).to_f, @future_3 @poller.poll - Sidekiq.redis do |conn| - assert_equal 0, conn.llen("queue:queue_1") - assert_equal 1, conn.llen("queue:queue_2") - assert_equal 0, conn.llen("queue:queue_5") - assert_equal 1, conn.llen("queue:queue_6") - end + assert_equal 0, Sidekiq::Queue.new("queue_1").size + assert_equal 1, Sidekiq::Queue.new("queue_2").size + assert_equal 0, Sidekiq::Queue.new("queue_5").size + assert_equal 1, Sidekiq::Queue.new("queue_6").size ensure Sidekiq.client_middleware.remove Stopper end end