File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Bug Fixes:
5
5
6
6
* Remove warning when calling ` driven_by ` in system specs. (Aubin Lorieux, #2302 )
7
7
* Fix comparison of times for ` #at ` in job matchers. (Jon Rowe, Markus Doits, #2304 )
8
+ * Fix when using a mailer with ` delivery_job ` set to a sub class of ` ActionMailer::DeliveryJob ` (Atsushi Yoshida #2305 )
8
9
9
10
### 4.0.0 / 2020-03-24
10
11
[ Full Changelog] ( https://github.com/rspec/rspec-rails/compare/v3.9.1...v4.0.0 )
Original file line number Diff line number Diff line change @@ -131,15 +131,15 @@ def mail_job_message(job)
131
131
end
132
132
133
133
def legacy_mail? ( job )
134
- job [ :job ] = = ActionMailer ::DeliveryJob
134
+ job [ :job ] < = ActionMailer ::DeliveryJob
135
135
end
136
136
137
137
def parameterized_mail? ( job )
138
- RSpec ::Rails ::FeatureCheck . has_action_mailer_parameterized? && job [ :job ] = = ActionMailer ::Parameterized ::DeliveryJob
138
+ RSpec ::Rails ::FeatureCheck . has_action_mailer_parameterized? && job [ :job ] < = ActionMailer ::Parameterized ::DeliveryJob
139
139
end
140
140
141
141
def unified_mail? ( job )
142
- RSpec ::Rails ::FeatureCheck . has_action_mailer_unified_delivery? && job [ :job ] = = ActionMailer ::MailDeliveryJob
142
+ RSpec ::Rails ::FeatureCheck . has_action_mailer_unified_delivery? && job [ :job ] < = ActionMailer ::MailDeliveryJob
143
143
end
144
144
end
145
145
# @api public
Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ class UnifiedMailer < ActionMailer::Base
21
21
def test_email ; end
22
22
def email_with_args ( arg1 , arg2 ) ; end
23
23
end
24
+
25
+ class DeliveryJobSubClass < ActionMailer ::DeliveryJob
26
+ end
27
+
28
+ class UnifiedMailerWithDeliveryJobSubClass < ActionMailer ::Base
29
+ self . delivery_job = DeliveryJobSubClass
30
+
31
+ def test_email ; end
32
+ end
24
33
end
25
34
end
26
35
@@ -397,6 +406,12 @@ def self.name; "NonMailerJob"; end
397
406
a_hash_including ( params : { 'foo' => 'bar' } , args : [ 1 , 2 ] )
398
407
)
399
408
end
409
+
410
+ it "passes when using a mailer with `delivery_job` set to a sub class of `ActionMailer::DeliveryJob`" do
411
+ expect {
412
+ UnifiedMailerWithDeliveryJobSubClass . test_email . deliver_later
413
+ } . to have_enqueued_mail ( UnifiedMailerWithDeliveryJobSubClass , :test_email )
414
+ end
400
415
end
401
416
end
402
417
end
You can’t perform that action at this time.
0 commit comments