Skip to content

Commit bde12f2

Browse files
committed
Fix unified mailer args
1 parent bfab5ed commit bde12f2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/rspec/rails/matchers/have_enqueued_mail.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ def base_mailer_args
106106
end
107107

108108
def yield_mail_args(block)
109-
proc { |*job_args| block.call(*(job_args - base_mailer_args)) }
109+
proc do |*job_args|
110+
mailer_args = job_args - base_mailer_args
111+
if mailer_args.first.is_a?(Hash)
112+
block.call(*mailer_args.first[:args])
113+
else
114+
block.call(*mailer_args)
115+
end
116+
end
110117
end
111118

112119
def check_active_job_adapter
@@ -133,7 +140,8 @@ def unmatching_mail_jobs_message
133140

134141
def mail_job_message(job)
135142
mailer_method = job[:args][0..1].join('.')
136-
mailer_args = job[:args][3..-1]
143+
mailer_args = deserialize_arguments(job)[3..-1]
144+
mailer_args = mailer_args.first[:args] if unified_mail?(job)
137145
msg_parts = []
138146
msg_parts << "with #{mailer_args}" if mailer_args.any?
139147
msg_parts << "on queue #{job[:queue]}" if job[:queue] && job[:queue] != 'mailers'

0 commit comments

Comments
 (0)