1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Merge branch 'master' of github.com:mperham/sidekiq

This commit is contained in:
Mike Perham 2013-01-05 21:17:28 -08:00
commit aaabdc9a75
2 changed files with 5 additions and 0 deletions

View file

@ -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)

View file

@ -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