aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/test_helper.rb
diff options
context:
space:
mode:
authorMarcus Ilgner <marcus.ilgner@evopark.de>2018-06-28 11:01:55 +0200
committerMarcus Ilgner <marcus.ilgner@evopark.de>2018-06-28 11:01:55 +0200
commit3919cb398b7de5efc94332dbde2924257d479a42 (patch)
treeb350db63c5de47055d0433cea3d02d110259acce /activejob/lib/active_job/test_helper.rb
parent5a1ea09062eaed78e21253a128d433a1beb745ad (diff)
downloadrails-3919cb398b7de5efc94332dbde2924257d479a42.tar.gz
rails-3919cb398b7de5efc94332dbde2924257d479a42.tar.bz2
rails-3919cb398b7de5efc94332dbde2924257d479a42.zip
Fix ActionMailer assert_enqueued_email_with
The documentation for assert_enqueued_email_with states that it's supposed to work without a block yet it calls assert_enqueued_with which doesn't check whether a block was passed before calling `yield`
Diffstat (limited to 'activejob/lib/active_job/test_helper.rb')
-rw-r--r--activejob/lib/active_job/test_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb
index 1cd2c40c15..43417b8a12 100644
--- a/activejob/lib/active_job/test_helper.rb
+++ b/activejob/lib/active_job/test_helper.rb
@@ -301,7 +301,7 @@ module ActiveJob
original_enqueued_jobs_count = enqueued_jobs.count
expected = { job: job, args: args, at: at, queue: queue }.compact
serialized_args = serialize_args_for_assertion(expected)
- yield
+ yield if block_given?
in_block_jobs = enqueued_jobs.drop(original_enqueued_jobs_count)
matching_job = in_block_jobs.find do |in_block_job|
serialized_args.all? { |key, value| value == in_block_job[key] }