spreewald icon indicating copy to clipboard operation
spreewald copied to clipboard

Include the Attachment header when the "an email should have been sent with" step does not match

Open makmic opened this issue 4 months ago • 0 comments

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)

makmic avatar Oct 23 '24 07:10 makmic