I wan’t to send an email to the user with his reset token. The mail is multipart both text and html. Also the user get’s a different email depending if the identity she/he provides is email or username.
I am using Bamboo according to phoenix guides.
Now I wan’t to test if the proper email template is delivered.
Bamboo does offer
assert_delivered_with(email_params) where params can be
body: "My whole text"
I would like to know if there is a better way. I want to check if body contains a specific text, not if it is a specific text. Something like the default phoenix page_controller_test
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
I changed the bamboo version from 0.8 to github in my mix file and now I use
assert_email_delivered_with(text_body: ~r/"The regexp"/) which can handle regexp. Now the test passes.