diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2018-10-09 13:46:16 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2018-10-12 12:15:16 -0400 |
commit | 3ebc22903433b97b38935778b955b53bc90447f6 (patch) | |
tree | 9d1f2fd0cbd09880b6a63212e1cb879a3938677a /activejob/lib | |
parent | c9e0a61db11b254d63169149fec5a263caa669db (diff) | |
download | rails-3ebc22903433b97b38935778b955b53bc90447f6.tar.gz rails-3ebc22903433b97b38935778b955b53bc90447f6.tar.bz2 rails-3ebc22903433b97b38935778b955b53bc90447f6.zip |
Include deserialized arguments in jobs returned by AJ test helpers
`assert_enqueued_with` and `assert_performed_with` return a instantiated
instance of the matching job for further assertion (#21010).
Before this commit the `arguments` method on the returned instance
returns a serialized version of the arguments.
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/test_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb index 261b68d4f8..d1a1fd6292 100644 --- a/activejob/lib/active_job/test_helper.rb +++ b/activejob/lib/active_job/test_helper.rb @@ -594,8 +594,7 @@ module ActiveJob def flush_enqueued_jobs(only: nil, except: nil, queue: nil) enqueued_jobs_with(only: only, except: except, queue: queue) do |payload| - args = ActiveJob::Arguments.deserialize(payload[:args]) - instantiate_job(payload.merge(args: args)).perform_now + instantiate_job(payload).perform_now queue_adapter.performed_jobs << payload end end @@ -613,7 +612,8 @@ module ActiveJob end def instantiate_job(payload) - job = payload[:job].new(*payload[:args]) + args = ActiveJob::Arguments.deserialize(payload[:args]) + job = payload[:job].new(*args) job.scheduled_at = Time.at(payload[:at]) if payload.key?(:at) job.queue_name = payload[:queue] job |