RSpec Email-Spec Problem

Hi!

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’
FAILED
expected /Enrollment Date:/, got “”

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

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 @email.parts
if part[“Content-Type”].to_s =~ /^text/html\W/
root = part.body
assert_match ‘

New Enrollment Form for
FakeFirstName FakeLastName

’, root.to_s
end
end
end

Hope this will help someone.

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs