mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
upgrade sidekiq to 2.12.X
This commit is contained in:
parent
ae3f19e1a3
commit
c59cfbcea8
3 changed files with 19 additions and 5 deletions
|
@ -19,6 +19,6 @@ Gem::Specification.new do |gem|
|
|||
gem.require_paths = ["lib"]
|
||||
gem.extensions = ['ext/sidetiq_ext/extconf.rb']
|
||||
|
||||
gem.add_dependency 'sidekiq', '~> 2.8.0'
|
||||
gem.add_dependency 'sidekiq', '~> 2.12.0'
|
||||
gem.add_dependency 'ice_cube', '~> 0.10.0'
|
||||
end
|
||||
|
|
|
@ -20,6 +20,20 @@ Dir[File.join(File.dirname(__FILE__), 'fixtures/**/*.rb')].each do |fixture|
|
|||
require fixture
|
||||
end
|
||||
|
||||
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/v2.12.4/lib/sidekiq/client.rb#L39
|
||||
def self.push_old(item)
|
||||
normed = normalize_item(item)
|
||||
payload = process_single(item['class'], normed)
|
||||
|
||||
pushed = false
|
||||
pushed = raw_push_old([payload]) if payload
|
||||
pushed ? payload['jid'] : nil
|
||||
end
|
||||
end
|
||||
|
||||
class Sidetiq::TestCase < MiniTest::Unit::TestCase
|
||||
def setup
|
||||
Sidekiq.redis { |r| r.flushall }
|
||||
|
|
|
@ -23,7 +23,7 @@ class TestSidetiq < Sidetiq::TestCase
|
|||
|
||||
def test_scheduled
|
||||
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
|
||||
SimpleWorker.client_push_old(SimpleWorker.jobs.first)
|
||||
Sidekiq::Client.push_old(SimpleWorker.jobs.first)
|
||||
|
||||
scheduled = Sidetiq.scheduled
|
||||
|
||||
|
@ -38,7 +38,7 @@ class TestSidetiq < Sidetiq::TestCase
|
|||
|
||||
def test_scheduled_given_arguments
|
||||
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
|
||||
SimpleWorker.client_push_old(SimpleWorker.jobs.first)
|
||||
Sidekiq::Client.push_old(SimpleWorker.jobs.first)
|
||||
|
||||
assert_equal 1, Sidetiq.scheduled(SimpleWorker).length
|
||||
assert_equal 0, Sidetiq.scheduled(ScheduledWorker).length
|
||||
|
@ -49,10 +49,10 @@ class TestSidetiq < Sidetiq::TestCase
|
|||
|
||||
def test_scheduled_yields_each_job
|
||||
SimpleWorker.perform_at(Time.local(2011, 1, 1, 1))
|
||||
SimpleWorker.client_push_old(SimpleWorker.jobs.first)
|
||||
Sidekiq::Client.push_old(SimpleWorker.jobs.first)
|
||||
|
||||
ScheduledWorker.perform_at(Time.local(2011, 1, 1, 1))
|
||||
ScheduledWorker.client_push_old(ScheduledWorker.jobs.first)
|
||||
Sidekiq::Client.push_old(ScheduledWorker.jobs.first)
|
||||
|
||||
jobs = []
|
||||
Sidetiq.scheduled { |job| jobs << job }
|
||||
|
|
Loading…
Reference in a new issue