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/test/cases | |
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/test/cases')
-rw-r--r-- | activejob/test/cases/test_helper_test.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb index 83c71ab1c4..8dc32037ff 100644 --- a/activejob/test/cases/test_helper_test.rb +++ b/activejob/test/cases/test_helper_test.rb @@ -476,23 +476,23 @@ class EnqueuedJobsTest < ActiveJob::TestCase def test_assert_enqueued_with_returns job = assert_enqueued_with(job: LoggingJob) do - LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3) + LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3, keyword: true) end assert_instance_of LoggingJob, job assert_in_delta 5.minutes.from_now, job.scheduled_at, 1 assert_equal "default", job.queue_name - assert_equal [1, 2, 3], job.arguments + assert_equal [1, 2, 3, { keyword: true }], job.arguments end def test_assert_enqueued_with_with_no_block_returns - LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3) + LoggingJob.set(wait_until: 5.minutes.from_now).perform_later(1, 2, 3, keyword: true) job = assert_enqueued_with(job: LoggingJob) assert_instance_of LoggingJob, job assert_in_delta 5.minutes.from_now, job.scheduled_at, 1 assert_equal "default", job.queue_name - assert_equal [1, 2, 3], job.arguments + assert_equal [1, 2, 3, { keyword: true }], job.arguments end def test_assert_enqueued_with_failure @@ -1515,26 +1515,26 @@ class PerformedJobsTest < ActiveJob::TestCase end def test_assert_performed_with_returns - job = assert_performed_with(job: NestedJob, queue: "default") do - NestedJob.perform_later + job = assert_performed_with(job: LoggingJob, queue: "default") do + LoggingJob.perform_later(keyword: :sym) end - assert_instance_of NestedJob, job + assert_instance_of LoggingJob, job assert_nil job.scheduled_at - assert_equal [], job.arguments + assert_equal [{ keyword: :sym }], job.arguments assert_equal "default", job.queue_name end def test_assert_performed_with_without_block_returns - NestedJob.perform_later + LoggingJob.perform_later(keyword: :sym) perform_enqueued_jobs - job = assert_performed_with(job: NestedJob, queue: "default") + job = assert_performed_with(job: LoggingJob, queue: "default") - assert_instance_of NestedJob, job + assert_instance_of LoggingJob, job assert_nil job.scheduled_at - assert_equal [], job.arguments + assert_equal [{ keyword: :sym }], job.arguments assert_equal "default", job.queue_name end |