I’m using cucumber with my rails 3 app.
My step definition works like so:
Given /^a email reply from gmail$/ do
# Get the Raw Email
raw_email = File.read("#{Rails.root}/features/step_definitions/email_replies/gmail_webapp_standard_1.txt")
# Send it to the mailingjob to find the reply
parsed_email = ::MailingJob::find_reply(raw_email)
# Does the reply match correctly?
parsed_email.should == 'This is my reply. This is paragraph one.
This is paragraph two. Capture everything before me as this is the last sentence.
'
end
The issue here is that the parsed_email is two paragraphs, text formatted, not html. If it’s just one sentence it’s easy to compare to see if the two sentences match, but with formatting it fails. How can I do a .should where formatting works?
Thanks
Try replacing the line breaks with
\nin the step definition and that should work.