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