aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2018-10-09 13:46:16 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2018-10-12 12:15:16 -0400
commit3ebc22903433b97b38935778b955b53bc90447f6 (patch)
tree9d1f2fd0cbd09880b6a63212e1cb879a3938677a /activejob/test/cases
parentc9e0a61db11b254d63169149fec5a263caa669db (diff)
downloadrails-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.rb24
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