RSpec Email-Spec Problem


I am using email-spec gem with rspec to test email.
If the email is multipart email then the example fails.
The example passes if it’s not multipart email.
Any advise on how to get it to pass.

Here is the error:
‘Form Mailer should contain completed enrollment form in email body’
expected /Enrollment Date:/, got “”

Here is the example:
it ‘should contain completed enrollment form in email body’ do
@email.should have_text(/Enrollment Date:/)

Many thanks!

Anyone, who can help?

I have figure this out.
I wanted to share this in case someone is having the same problem.

I have taken a different route to test email body:
Here is how my example looks now:

it “should contain child’s first name and last name in email body” do
for part in
if part[“Content-Type”].to_s =~ /^text/html\W/
root = part.body
assert_match ‘

New Enrollment Form for
FakeFirstName FakeLastName

’, root.to_s

Hope this will help someone.