提交 01729406 编写于 作者: Y Yves Senn

Merge pull request #17005 from y-yagi/fix_aj_test_helper

add message to `assert` in `assert_enqueued_with`
......@@ -150,7 +150,7 @@ def assert_enqueued_with(args = {}, &_block)
matching_job = enqueued_jobs.any? do |job|
args.all? { |key, value| value == job[key] }
end
assert matching_job
assert matching_job, "No enqueued job found with #{args}"
ensure
queue_adapter.enqueued_jobs = original_enqueued_jobs + enqueued_jobs
end
......
......@@ -97,11 +97,13 @@ def test_assert_enqueued_job_failure
end
end
assert_raise ActiveSupport::TestCase::Assertion do
error = assert_raise ActiveSupport::TestCase::Assertion do
assert_enqueued_with(job: NestedJob, queue: 'low') do
NestedJob.perform_later
end
end
assert_equal 'No enqueued job found with {:job=>NestedJob, :queue=>"low"}', error.message
end
def test_assert_enqueued_job_args
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册