mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
prevent args being misused
This commit is contained in:
parent
633983ae86
commit
224a2bf93e
2 changed files with 5 additions and 0 deletions
|
@ -118,6 +118,7 @@ module Sidekiq
|
|||
def self.normalize_item(item)
|
||||
raise(ArgumentError, "Message must be a Hash of the form: { 'class' => SomeWorker, 'args' => ['bob', 1, :foo => 'bar'] }") unless item.is_a?(Hash)
|
||||
raise(ArgumentError, "Message must include a class and set of arguments: #{item.inspect}") if !item['class'] || !item['args']
|
||||
raise(ArgumentError, "Message args must be an Array") unless item['args'].is_a?(Array)
|
||||
raise(ArgumentError, "Message class must be either a Class or String representation of the class name") unless item['class'].is_a?(Class) || item['class'].is_a?(String)
|
||||
|
||||
if item['class'].is_a?(Class)
|
||||
|
|
|
@ -39,6 +39,10 @@ class TestClient < MiniTest::Unit::TestCase
|
|||
Sidekiq::Client.push('queue' => 'foo', 'class' => 42, 'args' => [1, 2])
|
||||
end
|
||||
|
||||
assert_raises ArgumentError do
|
||||
Sidekiq::Client.push('queue' => 'foo', 'class' => MyWorker, 'args' => 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it 'pushes messages to redis' do
|
||||
|
|
Loading…
Reference in a new issue