File tree Expand file tree Collapse file tree 3 files changed +3
-21
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 3 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 1
1
Feature : `send_email` matcher
2
2
3
- The `send_email` matcher is used to check if an email with the given parameters has been sent during a spec example run .
3
+ The `send_email` matcher is used to check if an email with the given parameters has been sent inside the expectation block .
4
4
5
5
NOTE: It implies that the spec example actually sends the email using the test adapter and does not schedule it for background.
6
6
@@ -66,21 +66,3 @@ Feature: `send_email` matcher
66
66
"""
67
67
When I run `rspec spec/mailers/notifications_mailer_spec.rb`
68
68
Then the examples should all pass
69
-
70
- Scenario : Checking email sent with a wrong parameter
71
- Given a file named "spec/mailers/notifications_mailer_spec.rb" with:
72
- """ruby
73
- require "rails_helper"
74
-
75
- RSpec.describe NotificationsMailer do
76
- it "checks email not sent" do
77
- expect {
78
- NotificationsMailer.signup.deliver_now
79
- }.to send_email(
80
-
81
- )
82
- end
83
- end
84
- """
85
- When I run `rspec spec/mailers/notifications_mailer_spec.rb`
86
- Then the examples should fail
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def multiple_match?
91
91
92
92
def sent_emails_message
93
93
if @diff . empty?
94
- "\n \n No emails were sent."
94
+ "\n \n There were no any emails sent inside the expectation block ."
95
95
else
96
96
sent_emails =
97
97
@diff . map do |email |
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def test_email
60
60
} . to raise_error ( RSpec ::Expectations ::ExpectationNotMetError , <<~MSG . strip )
61
61
No matching emails were sent.
62
62
63
- No emails were sent.
63
+ There were no any emails sent inside the expectation block .
64
64
MSG
65
65
end
66
66
You can’t perform that action at this time.
0 commit comments