Open Stamates opened 2 years ago
This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet. If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.
We often have dynamic content (and emojis) in the subject line of emails such that we normally use a Regex pattern match. Example:
assert_email_delivered_with(subject: ~r/Request/)
As a testing pattern, we'll have a second test that is expected to NOT send the same email based on other failing conditions. For test readability, it would be great to just use
refute_email_delivered_with(subject: ~r/Request/)
, unfortunately, that returns the following error:I believe this is due to a bug in the refute_email_delivered_with function: The
received_email_params
is being set to[]
if no email is sent, but theif
check isis_nil(received_email_params)
which will befalse
instead oftrue
like it should be if no email was sent. This causeselse
condition to be called which results in a failure because[][:some_key] == nil
.The same Regex error occurs if you try to
refute_email_delivered_with
using an invalid email key when an email is actually received. Seems like the solve might be addingdo_match(nil, _, _), do: refute false
as a first function head (if we expect providing an invalid email key forrefute_email_delivered_with
to pass when an email is delivered).