Skip to content

Commit 27c5c7c

Browse files
Merge pull request rails#48920 from fidalgo/fidalgo/update-assert_enqueued_with-documentation
[docs] Update assert_enqueued_with documentation with keyword arguments example
2 parents 72b356c + 9dbac2c commit 27c5c7c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

activejob/lib/active_job/test_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ def assert_no_performed_jobs(only: nil, except: nil, queue: nil, &block)
354354
# assert_enqueued_with(at: Date.tomorrow.noon, queue: "my_queue")
355355
# end
356356
#
357+
# For keyword arguments, specify them as a hash inside an array:
358+
#
359+
# def test_assert_enqueued_with_keyword_arguments
360+
# MyJob.perform_later(arg1: 'value1', arg2: 'value2')
361+
# assert_enqueued_with(job: MyJob, args: [{ arg1: 'value1', arg2: 'value2' }])
362+
# end
363+
#
357364
# The given arguments may also be specified as matcher procs that return a
358365
# boolean value indicating whether a job's attribute meets certain criteria.
359366
#

0 commit comments

Comments
 (0)