Skip to content

Commit

Permalink
Fix ActionMailer assert_enqueued_email_with
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
milgner committed Jun 28, 2018
1 parent 5a1ea09 commit 3919cb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activejob/lib/active_job/test_helper.rb
Expand Up @@ -301,7 +301,7 @@ def assert_enqueued_with(job: nil, args: nil, at: nil, queue: nil)
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] }
Expand Down

0 comments on commit 3919cb3

Please sign in to comment.