Rails 4.2 Mailer Problem


Since we updated our application to Rails 4.2, our mailer tests seems to
fail (or not) randomly.

Simplified mailer code:

class ReservationMailer < ActionMailer::Base
default from: ‘removed_email_address@domain.invalid’,
bcc: ‘removed_email_address@domain.invalid’

def reservation_received(reservation)
@reservation = reservation
@product = reservation.product

mail to: @reservation.email,
     from: 'removed_email_address@domain.invalid',
     subject: "Bestätigung Eingang Vormerkung für Produkt


Simplified test code:

reservation = Reservation.new(email: 'removed_email_address@domain.invalid', product:


email = 


assert_equal 1, ActionMailer::Base.deliveries.size

There are some more mailers very similar to this mailer and the tests
to fail randomly.

That means, sometimes just one of these tests fail, sometimes two and
somewhen nothing fails.

I couldn’t figure out any problem, but maybe you can help me out :slight_smile:


Having this problem to. Have you found any solutions for it yet?