Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions spec/support/mailer_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ def strip_tags(str)

def expect_delivered_email(index, hash)
mail = ActionMailer::Base.deliveries[index]
expect(mail.to).to eq hash[:to] if hash[:to]

expect(mail.subject).to eq hash[:subject] if hash[:subject]
aggregate_failures do
expect(mail.to).to eq hash[:to] if hash[:to]
expect(mail.subject).to eq hash[:subject] if hash[:subject]

if hash[:body]
delivered_body = mail.text_part.decoded.gsub("\r\n", ' ')
hash[:body].to_a.each do |expected_body|
expect(delivered_body).to include(expected_body)
if hash[:body]
delivered_body = mail.text_part.decoded.gsub("\r\n", ' ')
hash[:body].to_a.each do |expected_body|
expect(delivered_body).to include(expected_body)
end
end
end
end
Expand Down