File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,7 @@ def description
28
28
29
29
def with ( *args , &block )
30
30
@mail_args = args
31
-
32
- super ( *mailer_args ) do |*job_args |
33
- block . call ( *( job_args - base_mailer_args ) ) if block . present?
34
- end
31
+ block . nil? ? super ( *mailer_args ) : super ( *mailer_args , &yield_mail_args ( block ) )
35
32
end
36
33
37
34
def matches? ( block )
@@ -86,6 +83,10 @@ def base_mailer_args
86
83
[ @mailer_class . name , @method_name . to_s , MAILER_JOB_METHOD ]
87
84
end
88
85
86
+ def yield_mail_args ( block )
87
+ Proc . new { |*job_args | block . call ( *( job_args - base_mailer_args ) ) }
88
+ end
89
+
89
90
def check_active_job_adapter
90
91
return if ::ActiveJob ::QueueAdapters ::TestAdapter === ::ActiveJob ::Base . queue_adapter
91
92
raise StandardError , "To use HaveEnqueuedMail matcher set `ActiveJob::Base.queue_adapter = :test`"
You can’t perform that action at this time.
0 commit comments