File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ require "spec_helper"
2
+ require "rspec/rails/feature_check"
3
+
4
+ if RSpec ::Rails ::FeatureCheck . has_active_job?
5
+ require "action_mailer"
6
+ require "rspec/rails/matchers/have_enqueued_mail"
7
+
8
+ class TestMailer < ActionMailer ::Base
9
+ def test_email ; end
10
+ def email_with_args ( arg1 , arg2 ) ; end
11
+ end
12
+ end
13
+
14
+ RSpec . describe "HaveEnqueuedMail matchers" , skip : !RSpec ::Rails ::FeatureCheck . has_active_job? do
15
+ before do
16
+ ActiveJob ::Base . queue_adapter = :test
17
+ end
18
+
19
+ describe "have_enqueued_mail" do
20
+ it "passes when a mailer method is called with deliver_later" do
21
+ expect {
22
+ TestMailer . test_email . deliver_later
23
+ } . to have_enqueued_mail ( TestMailer , :test_email )
24
+ end
25
+ end
26
+ end
You can’t perform that action at this time.
0 commit comments