Skip to content

Commit 9474245

Browse files
author
Joel Lubrano
committed
Test that non-mailer jobs do not appear in the have_enqueued_mail matcher list of mail jobs
1 parent b593ede commit 9474245

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/rspec/rails/matchers/have_enqueued_mail_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ def email_with_optional_args(required_arg, optional_arg = nil); end
216216
end
217217

218218
it "generates a failure message with unmatching enqueued mail jobs" do
219+
non_mailer_job = Class.new(ActiveJob::Base) do
220+
def perform; end
221+
def self.name; "NonMailerJob"; end
222+
end
223+
219224
send_time = Date.tomorrow.noon
220225
queue = 'urgent_mail'
221226

@@ -226,6 +231,7 @@ def email_with_optional_args(required_arg, optional_arg = nil); end
226231

227232
expect {
228233
expect {
234+
non_mailer_job.perform_later
229235
TestMailer.test_email.deliver_later
230236
TestMailer.email_with_args(3, 4).deliver_later(:wait_until => send_time, :queue => queue)
231237
}.to have_enqueued_email(TestMailer, :email_with_args).with(1, 2)

0 commit comments

Comments
 (0)