instance method
find_matching_job
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
find_matching_job(jobs, expected_args, job)
No documentation comment.
Parameters
-
jobsreq -
expected_argsreq -
jobreq
Source
# File activejob/lib/active_job/test_helper.rb, line 750
def find_matching_job(jobs, expected_args, job)
potential_matches = []
matching_job = jobs.find do |enqueued_job|
deserialized_job = deserialize_args_for_assertion(enqueued_job)
potential_matches << deserialized_job
expected_args.all? do |key, value|
if value.respond_to?(:call)
value.call(deserialized_job[key])
else
value == deserialized_job[key]
end
end
end
matching_class = potential_matches.select do |enqueued_job|
enqueued_job["job_class"] == job.to_s
end
[matching_job, potential_matches, matching_class]
end
Defined in activejob/lib/active_job/test_helper.rb line 750
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveJob::TestHelper