mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Verify JSON round trip symmetry of arguments, #2870
We can't do this today because ActiveJob in Rails 4 is not symmetric. https://github.com/rails/rails/pull/24123
This commit is contained in:
parent
7a982977a9
commit
69c9d66740
2 changed files with 2 additions and 1 deletions
|
@ -205,6 +205,7 @@ module Sidekiq
|
|||
raise(ArgumentError, "Job must be a Hash with 'class' and 'args' keys: { 'class' => SomeWorker, 'args' => ['bob', 1, :foo => 'bar'] }") unless item.is_a?(Hash) && item.has_key?('class'.freeze) && item.has_key?('args'.freeze)
|
||||
raise(ArgumentError, "Job args must be an Array") unless item['args'].is_a?(Array)
|
||||
raise(ArgumentError, "Job class must be either a Class or String representation of the class name") unless item['class'.freeze].is_a?(Class) || item['class'.freeze].is_a?(String)
|
||||
#raise(ArgumentError, "Arguments must be native JSON types, see https://github.com/mperham/sidekiq/wiki/Best-Practices") unless JSON.load(JSON.dump(item['args'])) == item['args']
|
||||
|
||||
normalized_hash(item['class'.freeze])
|
||||
.each{ |key, value| item[key] = value if item[key].nil? }
|
||||
|
|
|
@ -86,7 +86,7 @@ class TestInline < Sidekiq::Test
|
|||
end
|
||||
|
||||
it 'should relay parameters through json' do
|
||||
assert Sidekiq::Client.enqueue(InlineWorkerWithTimeParam, Time.now)
|
||||
assert Sidekiq::Client.enqueue(InlineWorkerWithTimeParam, Time.now.to_f)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue