My Ruby on Rails web application sends a welcome email to clients and I want to write a test to make sure the email contains an tag where the src is a .png file. I saw assert_select might do what I want but since my email is a Mail::Message class, I can only grab the html from the email. Thanks in advance for the help!
Test if html contains image tag with .png file Ruby
242 views Asked by Ccyan At
2
There are 2 answers
1
On
I'm not sure if it works but i guess you can do something like that.
expect(mail.body).to match(/.*.<img.*.png.*/)
https://github.com/rspec/rspec-expectations#regular-expressions
Here's
assert_select_emailfrom the exemplary Redmine:All Rails programmers should study literature like Redmine to learn lots of helpful tricks.