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:
55
66* Remove warning when calling ` driven_by ` in system specs. (Aubin Lorieux, #2302 )
77* 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 )
89
910### 4.0.0 / 2020-03-24
1011[ 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)
131131 end
132132
133133 def legacy_mail? ( job )
134- job [ :job ] = = ActionMailer ::DeliveryJob
134+ job [ :job ] < = ActionMailer ::DeliveryJob
135135 end
136136
137137 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
139139 end
140140
141141 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
143143 end
144144 end
145145 # @api public
Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ class UnifiedMailer < ActionMailer::Base
2121 def test_email ; end
2222 def email_with_args ( arg1 , arg2 ) ; end
2323 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
2433 end
2534end
2635
@@ -397,6 +406,12 @@ def self.name; "NonMailerJob"; end
397406 a_hash_including ( params : { 'foo' => 'bar' } , args : [ 1 , 2 ] )
398407 )
399408 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
400415 end
401416 end
402417end
You can’t perform that action at this time.
0 commit comments