Action Mailer 3.2.9 returns duplicates in deliveries array

I am extracting a standalone batch application from a Rails 3.0.1
project. This requires only ActiveRecord and ActionMailer. In my
testing I set

ActionMailer::Base.delivery_method = :test

This causes the mail to be delivered to the
ActionMailer::Base.deliveries array. However, I am getting two of the
test email messages placed in the deliveries array instead of just one.
For example:

'[
#<Mail::Message:38151600,
Multipart: false,
Headers:
<Date: Wed, 05 Dec 2012 16:05:16 -0500>,
<From: [email protected]>,
<To: [email protected]>,
<Message-ID:
[email protected]>,
<Subject: [ForEx] 2012-12-05 - Foreign Exchange Rates Central Bank
Update Notice>,
<Mime-Version: 1.0>,
<Content-Type: text/plain>,
<Content-Transfer-Encoding: 7bit>>,

#<Mail::Message:38151600,
Multipart: false,
Headers:
<Date: Wed, 05 Dec 2012 16:05:16 -0500>,
<From: [email protected]>,
<To: [email protected]>,
<Message-ID:
[email protected]>,
<Subject: [ForEx] 2012-12-05 - Foreign Exchange Rates Central Bank
Update Notice>,
<Mime-Version: 1.0>,
<Content-Type: text/plain>,
<Content-Transfer-Encoding: 7bit>>
]’

I can forcibly fix this with a call to deliveries.unique but I would
rather find out what is actually happening. Wherever this is occuring
it is between the call to the mail method in the mailer class and the
return from that class back to the calling script. As I provide no
intervening code and since self.deliveries does not exist inside the
mailer class on return from the mail method I gather that this array and
method is being created and populated somewhere in the ActionMailer
stack outside of my pervue.

Does anyone have any idea why this is happening?

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