1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Sidekiq 2.16 compatibility

This commit is contained in:
John Griffin 2013-10-29 17:14:59 +00:00
parent 70a6a33214
commit f9b94201c3
3 changed files with 9 additions and 6 deletions

View file

@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.extensions = []
gem.add_dependency 'sidekiq', '~> 2.15.0'
gem.add_dependency 'sidekiq', '~> 2.16.0'
gem.add_dependency 'celluloid', '>= 0.14.1'
gem.add_dependency 'ice_cube', '~> 0.11.0'

View file

@ -35,7 +35,7 @@ class Sidekiq::Client
# Sidekiq testing helper now overwrites raw_push so we need to use
# raw_push_old below to keep tests as is.
# https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/testing.rb
def self.push_old(item)
def push_old(item)
normed = normalize_item(item)
payload = process_single(item['class'], normed)

View file

@ -19,9 +19,10 @@ class TestSidetiq < Sidetiq::TestCase
end
def test_scheduled
client = Sidekiq::Client.new
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
hash = SimpleWorker.jobs.first
Sidekiq::Client.push_old(hash.merge("at" => hash["enqueued_at"]))
client.push_old(hash.merge("at" => hash["enqueued_at"]))
scheduled = Sidetiq.scheduled
@ -35,9 +36,10 @@ class TestSidetiq < Sidetiq::TestCase
end
def test_scheduled_given_arguments
client = Sidekiq::Client.new
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
hash = SimpleWorker.jobs.first
Sidekiq::Client.push_old(hash.merge("at" => hash["enqueued_at"]))
client.push_old(hash.merge("at" => hash["enqueued_at"]))
assert_equal 1, Sidetiq.scheduled(SimpleWorker).length
assert_equal 0, Sidetiq.scheduled(ScheduledWorker).length
@ -47,13 +49,14 @@ class TestSidetiq < Sidetiq::TestCase
end
def test_scheduled_yields_each_job
client = Sidekiq::Client.new
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
hash = SimpleWorker.jobs.first
Sidekiq::Client.push_old(hash.merge("at" => hash["enqueued_at"]))
client.push_old(hash.merge("at" => hash["enqueued_at"]))
ScheduledWorker.perform_at(Time.local(2011, 1, 1, 1))
hash = ScheduledWorker.jobs.first
Sidekiq::Client.push_old(hash.merge("at" => hash["enqueued_at"]))
client.push_old(hash.merge("at" => hash["enqueued_at"]))
jobs = []
Sidetiq.scheduled { |job| jobs << job }