spreewald
spreewald copied to clipboard
Include the Attachment header when the "an email should have been sent with" step does not match
I noticed that the debugging experience of the email matching step is not the best when you're asserting the Attachments
header with an invalid value. For example:
And an email should have been sent with:
"""
From: [email protected]
To: [email protected]
Subject: My subject
Attachments: logo.png
Dear Mr Bar Foo,
If the actual e-mail has an attachment called icon.png
instead of logo.png
, spreewald currently outputs such a message:
No matching mail was found. There were 1 mails in total.
0 of those had matching headers.
Expected
--------------------------------------------------------------------------------
From: [email protected]
To: [email protected]
Subject: My subject
Attachments: logo.png
--------------------------------------------------------------------------------
E-Mail #0
--------------------------------------------------------------------------------
From: ["[email protected]"]
To: [email protected]
BCC:
Subject: My subject
--------------------------------------------------------------------------------
(RSpec::Expectations::ExpectationNotMetError)
Note that the Attachment
information is missing for the listed mails, while the empty BCC
header could be skipped.
A better output could be:
No matching mail was found. There were 1 mails in total.
0 of those had matching headers.
Expected
--------------------------------------------------------------------------------
From: [email protected]
To: [email protected]
Subject: My subject
Attachments: logo.png
--------------------------------------------------------------------------------
E-Mail #0
--------------------------------------------------------------------------------
From: ["[email protected]"]
To: [email protected]
Subject: My subject
Attachments: icon.png
--------------------------------------------------------------------------------
(RSpec::Expectations::ExpectationNotMetError)