Fixed that the mail method should return a Mail::Message (#15113).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
c6c0491ad8
commit
176ce78574
|
@ -368,7 +368,7 @@ class Mailer < ActionMailer::Base
|
|||
ActionMailer::Base.delivery_method = saved_method
|
||||
end
|
||||
|
||||
def mail(headers={})
|
||||
def mail(headers={}, &block)
|
||||
headers.merge! 'X-Mailer' => 'Redmine',
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
'X-Redmine-Site' => Setting.app_title,
|
||||
|
@ -403,12 +403,17 @@ class Mailer < ActionMailer::Base
|
|||
headers[:references] = @references_objects.collect {|o| "<#{self.class.references_for(o)}>"}.join(' ')
|
||||
end
|
||||
|
||||
m = if block_given?
|
||||
super headers, &block
|
||||
else
|
||||
super headers do |format|
|
||||
format.text
|
||||
format.html unless Setting.plain_text_mail?
|
||||
end
|
||||
|
||||
end
|
||||
set_language_if_valid @initial_language
|
||||
|
||||
m
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
|
|
|
@ -725,6 +725,10 @@ class MailerTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_mail_should_return_a_mail_message
|
||||
assert_kind_of ::Mail::Message, Mailer.test_email(User.find(1))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def last_email
|
||||
|
|
Loading…
Reference in New Issue