mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Can't use constantize if the worker doesn't exist
This commit is contained in:
parent
321234e81d
commit
ec006873ac
2 changed files with 12 additions and 2 deletions
|
@ -68,7 +68,7 @@ module Sidekiq
|
|||
def raw_push(payloads)
|
||||
if Sidekiq::Testing.fake?
|
||||
payloads.each do |job|
|
||||
Queues.jobs[job['class'].constantize.sidekiq_options["queue"]] << Sidekiq.load_json(Sidekiq.dump_json(job))
|
||||
Queues.jobs[job['queue']] << Sidekiq.load_json(Sidekiq.dump_json(job))
|
||||
end
|
||||
true
|
||||
elsif Sidekiq::Testing.inline?
|
||||
|
|
|
@ -94,7 +94,7 @@ class TestTesting < Sidekiq::Test
|
|||
it 'stubs the enqueue_to call' do
|
||||
assert_equal 0, EnqueuedWorker.jobs.size
|
||||
assert Sidekiq::Client.enqueue_to('someq', EnqueuedWorker, 1, 2)
|
||||
assert_equal 1, EnqueuedWorker.jobs.size
|
||||
assert_equal 1, Sidekiq::Queues['someq'].size
|
||||
end
|
||||
|
||||
it 'executes all stored jobs' do
|
||||
|
@ -317,5 +317,15 @@ class TestTesting < Sidekiq::Test
|
|||
assert_equal 0, Sidekiq::Queues["default"].size
|
||||
assert_equal 0, Sidekiq::Queues["alt"].size
|
||||
end
|
||||
|
||||
it 'finds jobs enqueued by client' do
|
||||
Sidekiq::Client.push(
|
||||
'class' => 'NonExistentWorker',
|
||||
'queue' => 'missing',
|
||||
'args' => [1]
|
||||
)
|
||||
|
||||
assert_equal 1, Sidekiq::Queues["missing"].size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue