mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
29e502f374
Error messages from assert_enqueued_with and assert_performed_with shows which other jobs are enqueued or performed when you get an error. We can improve these messages to make it clearer why the job didn't match. This one error messages now have three different formats based on why the job didn't match 1. Didn't match because no jobs are queued at all. This now reports, ``` No performed job found with {:job=>HelloJob, :args=>[]} No jobs where performed ``` 2. Didn't match because that job class was not queued. This now reports, ``` No performed job found with {:job=>MultipleKwargsJob, :args=>[#<Person:0x00007fe38f9f8100 @id=11>]} No jobs of class MultipleKwargsJob where performed, job classes performed: HelloJob ``` 3. Doesn't match due to arguments, queue, priority or other reason. This now reports ``` No performed job found with {:job=>HelloJob, :args=>[#<Person:0x00007fe3a89fc2c8 @id=11>]} Potential matches: {"job_class"=>"HelloJob", "job_id"=>"f8636fd9-c7a0-4565-9198-17e175f30f0e", "provider_job_id"=>nil, "queue_name"=>"default", "priority"=>nil, "arguments"=>[{"_aj_globalid"=>"gid://aj/Person/9"}], "executions"=>0, "exception_executions"=>{}, "locale"=>"en", "timezone"=>nil, "enqueued_at"=>"2021-10-27T23:19:54Z", :job=>HelloJob, :args=>[#<Person:0x00007fe3a89dce00 @id="9">], :queue=>"default", :priority=>nil} ``` Which matches the old error message, but only reports jobs that where queued of the same class as the job you are asserting was queued. |
||
---|---|---|
.. | ||
active_job | ||
rails/generators/job | ||
active_job.rb |