diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb index c7e098c7b..c936f2edd 100644 --- a/lib/sidekiq/client.rb +++ b/lib/sidekiq/client.rb @@ -95,7 +95,7 @@ def push_bulk(items) return [] if args.empty? # no jobs to push at = items.delete("at") - raise ArgumentError, "Job 'at' must be a Numeric or an Array of Numeric timestamps" if at && (Array(at).empty? || !Array(at).all?(Numeric)) + raise ArgumentError, "Job 'at' must be a Numeric or an Array of Numeric timestamps" if at && (Array(at).empty? || !Array(at).all?{|entry| entry.is_a?(Numeric) }) raise ArgumentError, "Job 'at' Array must have same size as 'args' Array" if at.is_a?(Array) && at.size != args.size normed = normalize_item(items) diff --git a/test/test_client.rb b/test/test_client.rb index f208ece02..5665fcd3e 100644 --- a/test/test_client.rb +++ b/test/test_client.rb @@ -148,6 +148,11 @@ class QueuedWorker assert_equal second_at, Sidekiq::ScheduledSet.new.find_job(second_jid).at end + it 'can push jobs scheduled using ActiveSupport::Duration' do + jids = Sidekiq::Client.push_bulk('class' => QueuedWorker, 'args' => [[1], [2]], 'at' => [1.seconds, 111.seconds]) + assert_equal 2, jids.size + end + it 'returns the jids for the jobs' do Sidekiq::Client.push_bulk('class' => 'QueuedWorker', 'args' => (1..2).to_a.map { |x| Array(x) }).each do |jid| assert_match(/[0-9a-f]{12}/, jid)