activejob/lib/active_job/test_helper.rb
def assert_enqueued_with(args = {}, &_block)
        original_enqueued_jobs = enqueued_jobs.dup
        clear_enqueued_jobs
        args.assert_valid_keys(:job, :args, :at, :queue)
        yield
        matching_job = enqueued_jobs.any? do |job|
          args.all? { |key, value| value == job[key] }
        end
        assert matching_job
      ensure
        queue_adapter.enqueued_jobs = original_enqueued_jobs + enqueued_jobs
      end
# Asserts that the job passed in the block has been enqueued with the given arguments.
#
#   def assert_enqueued_job
#     assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low') do
#       MyJob.perform_later(1,2,3)
#     end
#   end
Asserts that the job passed in the block has been enqueued with the given arguments.
Asserts that the job passed in the block has been enqueued with the given arguments .
def assert_enqueued_with(args = {}, &_block)
        original_enqueued_jobs = enqueued_jobs.dup
        clear_enqueued_jobs
        args.assert_valid_keys(:job, :args, :at, :queue)
        yield
        matching_job = enqueued_jobs.any? do |job|
          args.all? { |key, value| value == job[key] }
        end
        assert matching_job
      ensure
        queue_adapter.enqueued_jobs = original_enqueued_jobs + enqueued_jobs
      end
def assert_enqueued_with ( args = { } , & _block ) original_enqueued_jobs = enqueued_jobs . dup clear_enqueued_jobs args . assert_valid_keys ( :job , :args , :at , :queue ) yield matching_job = enqueued_jobs . any? do | job | args . all? { | key , value | value == job [ key ] } end assert matching_job ensure queue_adapter . enqueued_jobs = original_enqueued_jobs + enqueued_jobs end
Asserts that the job passed in the block has been enqueued with the given arguments.
Asserts that the job passed in the block has been enqueued with the given arguments .
args
_block