replace Mailer deliver syntax to Rails3 style

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9638 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-05-05 13:07:12 +00:00
parent e876d1bfc0
commit 7af8d7caf0
16 changed files with 60 additions and 58 deletions

View File

@ -68,7 +68,7 @@ class AccountController < ApplicationController
# create a new token for password recovery # create a new token for password recovery
token = Token.new(:user => user, :action => "recovery") token = Token.new(:user => user, :action => "recovery")
if token.save if token.save
Mailer.deliver_lost_password(token) Mailer.lost_password(token).deliver
flash[:notice] = l(:notice_account_lost_email_sent) flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to :action => 'login' redirect_to :action => 'login'
return return
@ -235,7 +235,7 @@ class AccountController < ApplicationController
def register_by_email_activation(user, &block) def register_by_email_activation(user, &block)
token = Token.new(:user => user, :action => "register") token = Token.new(:user => user, :action => "register")
if user.save and token.save if user.save and token.save
Mailer.deliver_register(token) Mailer.register(token).deliver
flash[:notice] = l(:notice_account_register_done) flash[:notice] = l(:notice_account_register_done)
redirect_to :action => 'login' redirect_to :action => 'login'
else else
@ -265,7 +265,7 @@ class AccountController < ApplicationController
def register_manually_by_administrator(user, &block) def register_manually_by_administrator(user, &block)
if user.save if user.save
# Sends an email to the administrators # Sends an email to the administrators
Mailer.deliver_account_activation_request(user) Mailer.account_activation_request(user).deliver
account_pending account_pending
else else
yield if block_given? yield if block_given?

View File

@ -63,7 +63,7 @@ class AdminController < ApplicationController
# Force ActionMailer to raise delivery errors so we can catch it # Force ActionMailer to raise delivery errors so we can catch it
ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.raise_delivery_errors = true
begin begin
@test = Mailer.deliver_test_email(User.current) @test = Mailer.test_email(User.current).deliver
flash[:notice] = l(:notice_email_sent, User.current.mail) flash[:notice] = l(:notice_email_sent, User.current.mail)
rescue Exception => e rescue Exception => e
flash[:error] = l(:notice_email_error, e.message) flash[:error] = l(:notice_email_error, e.message)

View File

@ -86,7 +86,9 @@ class DocumentsController < ApplicationController
attachments = Attachment.attach_files(@document, params[:attachments]) attachments = Attachment.attach_files(@document, params[:attachments])
render_attachment_warning_if_needed(@document) render_attachment_warning_if_needed(@document)
Mailer.deliver_attachments_added(attachments[:files]) if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added') if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
Mailer.attachments_added(attachments[:files]).deliver
end
redirect_to :action => 'show', :id => @document redirect_to :action => 'show', :id => @document
end end
end end

View File

@ -46,7 +46,7 @@ class FilesController < ApplicationController
render_attachment_warning_if_needed(container) render_attachment_warning_if_needed(container)
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.deliver_attachments_added(attachments[:files]) Mailer.attachments_added(attachments[:files]).deliver
end end
redirect_to project_files_path(@project) redirect_to project_files_path(@project)
end end

View File

@ -99,7 +99,7 @@ class UsersController < ApplicationController
@user.pref.save @user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information] Mailer.account_information(@user, params[:user][:password]).deliver if params[:send_information]
respond_to do |format| respond_to do |format|
format.html { format.html {
@ -146,9 +146,9 @@ class UsersController < ApplicationController
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
if was_activated if was_activated
Mailer.deliver_account_activated(@user) Mailer.account_activated(@user).deliver
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil? elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
Mailer.deliver_account_information(@user, params[:user][:password]) Mailer.account_information(@user, params[:user][:password]).deliver
end end
respond_to do |format| respond_to do |format|

View File

@ -18,7 +18,7 @@
class CommentObserver < ActiveRecord::Observer class CommentObserver < ActiveRecord::Observer
def after_create(comment) def after_create(comment)
if comment.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added') if comment.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
Mailer.deliver_news_comment_added(comment) Mailer.news_comment_added(comment).deliver
end end
end end
end end

View File

@ -17,6 +17,6 @@
class DocumentObserver < ActiveRecord::Observer class DocumentObserver < ActiveRecord::Observer
def after_create(document) def after_create(document)
Mailer.deliver_document_added(document) if Setting.notified_events.include?('document_added') Mailer.document_added(document).deliver if Setting.notified_events.include?('document_added')
end end
end end

View File

@ -17,6 +17,6 @@
class IssueObserver < ActiveRecord::Observer class IssueObserver < ActiveRecord::Observer
def after_create(issue) def after_create(issue)
Mailer.deliver_issue_add(issue) if Setting.notified_events.include?('issue_added') Mailer.issue_add(issue).deliver if Setting.notified_events.include?('issue_added')
end end
end end

View File

@ -23,7 +23,7 @@ class JournalObserver < ActiveRecord::Observer
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) || (Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?) (Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
) )
Mailer.deliver_issue_edit(journal) Mailer.issue_edit(journal).deliver
end end
end end
end end

View File

@ -94,7 +94,7 @@ class MailHandler < ActionMailer::Base
if logger && logger.info if logger && logger.info
logger.info "MailHandler: [#{@user.login}] account created" logger.info "MailHandler: [#{@user.login}] account created"
end end
Mailer.deliver_account_information(@user, @user.password) Mailer.account_information(@user, @user.password).deliver
else else
if logger && logger.error if logger && logger.error
logger.error "MailHandler: could not create account for [#{sender_email}]" logger.error "MailHandler: could not create account for [#{sender_email}]"

View File

@ -17,6 +17,6 @@
class MessageObserver < ActiveRecord::Observer class MessageObserver < ActiveRecord::Observer
def after_create(message) def after_create(message)
Mailer.deliver_message_posted(message) if Setting.notified_events.include?('message_posted') Mailer.message_posted(message).deliver if Setting.notified_events.include?('message_posted')
end end
end end

View File

@ -17,6 +17,6 @@
class NewsObserver < ActiveRecord::Observer class NewsObserver < ActiveRecord::Observer
def after_create(news) def after_create(news)
Mailer.deliver_news_added(news) if Setting.notified_events.include?('news_added') Mailer.news_added(news).deliver if Setting.notified_events.include?('news_added')
end end
end end

View File

@ -17,12 +17,12 @@
class WikiContentObserver < ActiveRecord::Observer class WikiContentObserver < ActiveRecord::Observer
def after_create(wiki_content) def after_create(wiki_content)
Mailer.deliver_wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added') Mailer.wiki_content_added(wiki_content).deliver if Setting.notified_events.include?('wiki_content_added')
end end
def after_update(wiki_content) def after_update(wiki_content)
if wiki_content.text_changed? if wiki_content.text_changed?
Mailer.deliver_wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated') Mailer.wiki_content_updated(wiki_content).deliver if Setting.notified_events.include?('wiki_content_updated')
end end
end end
end end

View File

@ -177,7 +177,7 @@ END_DESC
ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.raise_delivery_errors = true
begin begin
Mailer.with_synched_deliveries do Mailer.with_synched_deliveries do
Mailer.deliver_test_email(user) Mailer.test_email(user).deliver
end end
puts l(:notice_email_sent, user.mail) puts l(:notice_email_sent, user.mail)
rescue Exception => e rescue Exception => e

View File

@ -148,14 +148,14 @@ class Redmine::Hook::ManagerTest < ActionView::TestCase
issue = Issue.find(1) issue = Issue.find(1)
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Mailer.deliver_issue_add(issue) Mailer.issue_add(issue).deliver
mail = ActionMailer::Base.deliveries.last mail = ActionMailer::Base.deliveries.last
@hook_module.add_listener(TestLinkToHook) @hook_module.add_listener(TestLinkToHook)
hook_helper.call_hook(:view_layouts_base_html_head) hook_helper.call_hook(:view_layouts_base_html_head)
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Mailer.deliver_issue_add(issue) Mailer.issue_add(issue).deliver
mail2 = ActionMailer::Base.deliveries.last mail2 = ActionMailer::Base.deliveries.last
assert_equal mail_body(mail), mail_body(mail2) assert_equal mail_body(mail), mail_body(mail2)

View File

@ -42,7 +42,7 @@ class MailerTest < ActiveSupport::TestCase
Setting.protocol = 'https' Setting.protocol = 'https'
journal = Journal.find(3) journal = Journal.find(3)
assert Mailer.deliver_issue_edit(journal) assert Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_not_nil mail assert_not_nil mail
@ -81,7 +81,7 @@ class MailerTest < ActiveSupport::TestCase
Setting.protocol = 'http' Setting.protocol = 'http'
journal = Journal.find(3) journal = Journal.find(3)
assert Mailer.deliver_issue_edit(journal) assert Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_not_nil mail assert_not_nil mail
@ -121,7 +121,7 @@ class MailerTest < ActiveSupport::TestCase
Redmine::Utils.relative_url_root = nil Redmine::Utils.relative_url_root = nil
journal = Journal.find(3) journal = Journal.find(3)
assert Mailer.deliver_issue_edit(journal) assert Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_not_nil mail assert_not_nil mail
@ -158,7 +158,7 @@ class MailerTest < ActiveSupport::TestCase
def test_email_headers def test_email_headers
issue = Issue.find(1) issue = Issue.find(1)
Mailer.deliver_issue_add(issue) Mailer.issue_add(issue).deliver
mail = last_email mail = last_email
assert_not_nil mail assert_not_nil mail
assert_equal 'OOF', mail.header['X-Auto-Response-Suppress'].to_s assert_equal 'OOF', mail.header['X-Auto-Response-Suppress'].to_s
@ -167,7 +167,7 @@ class MailerTest < ActiveSupport::TestCase
def test_email_headers_should_include_sender def test_email_headers_should_include_sender
issue = Issue.find(1) issue = Issue.find(1)
Mailer.deliver_issue_add(issue) Mailer.issue_add(issue).deliver
mail = last_email mail = last_email
assert_equal issue.author.login, mail.header['X-Redmine-Sender'].to_s assert_equal issue.author.login, mail.header['X-Redmine-Sender'].to_s
end end
@ -175,7 +175,7 @@ class MailerTest < ActiveSupport::TestCase
def test_plain_text_mail def test_plain_text_mail
Setting.plain_text_mail = 1 Setting.plain_text_mail = 1
journal = Journal.find(2) journal = Journal.find(2)
Mailer.deliver_issue_edit(journal) Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_equal "text/plain; charset=UTF-8", mail.content_type assert_equal "text/plain; charset=UTF-8", mail.content_type
assert_equal 0, mail.parts.size assert_equal 0, mail.parts.size
@ -185,7 +185,7 @@ class MailerTest < ActiveSupport::TestCase
def test_html_mail def test_html_mail
Setting.plain_text_mail = 0 Setting.plain_text_mail = 0
journal = Journal.find(2) journal = Journal.find(2)
Mailer.deliver_issue_edit(journal) Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_equal 2, mail.parts.size assert_equal 2, mail.parts.size
assert mail.encoded.include?('href') assert mail.encoded.include?('href')
@ -193,7 +193,7 @@ class MailerTest < ActiveSupport::TestCase
def test_from_header def test_from_header
with_settings :mail_from => 'redmine@example.net' do with_settings :mail_from => 'redmine@example.net' do
Mailer.deliver_test_email(User.find(1)) Mailer.test_email(User.find(1)).deliver
end end
mail = last_email mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first assert_equal 'redmine@example.net', mail.from_addrs.first
@ -201,7 +201,7 @@ class MailerTest < ActiveSupport::TestCase
def test_from_header_with_phrase def test_from_header_with_phrase
with_settings :mail_from => 'Redmine app <redmine@example.net>' do with_settings :mail_from => 'Redmine app <redmine@example.net>' do
Mailer.deliver_test_email(User.find(1)) Mailer.test_email(User.find(1)).deliver
end end
mail = last_email mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first assert_equal 'redmine@example.net', mail.from_addrs.first
@ -217,7 +217,7 @@ class MailerTest < ActiveSupport::TestCase
user.pref[:no_self_notified] = false user.pref[:no_self_notified] = false
user.pref.save user.pref.save
User.current = user User.current = user
Mailer.deliver_news_added(news.reload) Mailer.news_added(news.reload).deliver
assert_equal 1, last_email.bcc.size assert_equal 1, last_email.bcc.size
# nobody to notify # nobody to notify
@ -225,13 +225,13 @@ class MailerTest < ActiveSupport::TestCase
user.pref.save user.pref.save
User.current = user User.current = user
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Mailer.deliver_news_added(news.reload) Mailer.news_added(news.reload).deliver
assert ActionMailer::Base.deliveries.empty? assert ActionMailer::Base.deliveries.empty?
end end
def test_issue_add_message_id def test_issue_add_message_id
issue = Issue.find(1) issue = Issue.find(1)
Mailer.deliver_issue_add(issue) Mailer.issue_add(issue).deliver
mail = last_email mail = last_email
assert_equal Mailer.message_id_for(issue), mail.message_id assert_equal Mailer.message_id_for(issue), mail.message_id
assert_nil mail.references assert_nil mail.references
@ -239,7 +239,7 @@ class MailerTest < ActiveSupport::TestCase
def test_issue_edit_message_id def test_issue_edit_message_id
journal = Journal.find(1) journal = Journal.find(1)
Mailer.deliver_issue_edit(journal) Mailer.issue_edit(journal).deliver
mail = last_email mail = last_email
assert_equal Mailer.message_id_for(journal), mail.message_id assert_equal Mailer.message_id_for(journal), mail.message_id
assert_include Mailer.message_id_for(journal.issue), mail.references assert_include Mailer.message_id_for(journal.issue), mail.references
@ -252,7 +252,7 @@ class MailerTest < ActiveSupport::TestCase
def test_message_posted_message_id def test_message_posted_message_id
message = Message.find(1) message = Message.find(1)
Mailer.deliver_message_posted(message) Mailer.message_posted(message).deliver
mail = last_email mail = last_email
assert_equal Mailer.message_id_for(message), mail.message_id assert_equal Mailer.message_id_for(message), mail.message_id
assert_nil mail.references assert_nil mail.references
@ -266,7 +266,7 @@ class MailerTest < ActiveSupport::TestCase
def test_reply_posted_message_id def test_reply_posted_message_id
message = Message.find(3) message = Message.find(3)
Mailer.deliver_message_posted(message) Mailer.message_posted(message).deliver
mail = last_email mail = last_email
assert_equal Mailer.message_id_for(message), mail.message_id assert_equal Mailer.message_id_for(message), mail.message_id
assert_include Mailer.message_id_for(message.parent), mail.references assert_include Mailer.message_id_for(message.parent), mail.references
@ -286,13 +286,13 @@ class MailerTest < ActiveSupport::TestCase
end end
should "notify project members" do should "notify project members" do
assert Mailer.deliver_issue_add(@issue) assert Mailer.issue_add(@issue).deliver
assert last_email.bcc.include?('dlopper@somenet.foo') assert last_email.bcc.include?('dlopper@somenet.foo')
end end
should "not notify project members that are not allow to view the issue" do should "not notify project members that are not allow to view the issue" do
Role.find(2).remove_permission!(:view_issues) Role.find(2).remove_permission!(:view_issues)
assert Mailer.deliver_issue_add(@issue) assert Mailer.issue_add(@issue).deliver
assert !last_email.bcc.include?('dlopper@somenet.foo') assert !last_email.bcc.include?('dlopper@somenet.foo')
end end
@ -305,7 +305,7 @@ class MailerTest < ActiveSupport::TestCase
user.save user.save
Watcher.create!(:watchable => @issue, :user => user) Watcher.create!(:watchable => @issue, :user => user)
assert Mailer.deliver_issue_add(@issue) assert Mailer.issue_add(@issue).deliver
assert last_email.bcc.include?(user.mail) assert last_email.bcc.include?(user.mail)
end end
@ -313,7 +313,7 @@ class MailerTest < ActiveSupport::TestCase
user = User.find(9) user = User.find(9)
Watcher.create!(:watchable => @issue, :user => user) Watcher.create!(:watchable => @issue, :user => user)
Role.non_member.remove_permission!(:view_issues) Role.non_member.remove_permission!(:view_issues)
assert Mailer.deliver_issue_add(@issue) assert Mailer.issue_add(@issue).deliver
assert !last_email.bcc.include?(user.mail) assert !last_email.bcc.include?(user.mail)
end end
end end
@ -323,7 +323,7 @@ class MailerTest < ActiveSupport::TestCase
issue = Issue.find(1) issue = Issue.find(1)
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_issue_add(issue) assert Mailer.issue_add(issue).deliver
end end
end end
@ -331,7 +331,7 @@ class MailerTest < ActiveSupport::TestCase
journal = Journal.find(1) journal = Journal.find(1)
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_issue_edit(journal) assert Mailer.issue_edit(journal).deliver
end end
end end
@ -339,7 +339,7 @@ class MailerTest < ActiveSupport::TestCase
document = Document.find(1) document = Document.find(1)
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_document_added(document) assert Mailer.document_added(document).deliver
end end
end end
@ -347,13 +347,13 @@ class MailerTest < ActiveSupport::TestCase
attachements = [ Attachment.find_by_container_type('Document') ] attachements = [ Attachment.find_by_container_type('Document') ]
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_attachments_added(attachements) assert Mailer.attachments_added(attachements).deliver
end end
end end
def test_version_file_added def test_version_file_added
attachements = [ Attachment.find_by_container_type('Version') ] attachements = [ Attachment.find_by_container_type('Version') ]
assert Mailer.deliver_attachments_added(attachements) assert Mailer.attachments_added(attachements).deliver
assert_not_nil last_email.bcc assert_not_nil last_email.bcc
assert last_email.bcc.any? assert last_email.bcc.any?
assert_select_email do assert_select_email do
@ -363,7 +363,7 @@ class MailerTest < ActiveSupport::TestCase
def test_project_file_added def test_project_file_added
attachements = [ Attachment.find_by_container_type('Project') ] attachements = [ Attachment.find_by_container_type('Project') ]
assert Mailer.deliver_attachments_added(attachements) assert Mailer.attachments_added(attachements).deliver
assert_not_nil last_email.bcc assert_not_nil last_email.bcc
assert last_email.bcc.any? assert last_email.bcc.any?
assert_select_email do assert_select_email do
@ -375,7 +375,7 @@ class MailerTest < ActiveSupport::TestCase
news = News.find(:first) news = News.find(:first)
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_news_added(news) assert Mailer.news_added(news).deliver
end end
end end
@ -383,7 +383,7 @@ class MailerTest < ActiveSupport::TestCase
comment = Comment.find(2) comment = Comment.find(2)
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_news_comment_added(comment) assert Mailer.news_comment_added(comment).deliver
end end
end end
@ -393,7 +393,7 @@ class MailerTest < ActiveSupport::TestCase
recipients = recipients.compact.uniq recipients = recipients.compact.uniq
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert Mailer.deliver_message_posted(message) assert Mailer.message_posted(message).deliver
end end
end end
@ -402,7 +402,7 @@ class MailerTest < ActiveSupport::TestCase
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do assert_difference 'ActionMailer::Base.deliveries.size' do
assert Mailer.deliver_wiki_content_added(content) assert Mailer.wiki_content_added(content).deliver
end end
end end
end end
@ -412,7 +412,7 @@ class MailerTest < ActiveSupport::TestCase
valid_languages.each do |lang| valid_languages.each do |lang|
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do assert_difference 'ActionMailer::Base.deliveries.size' do
assert Mailer.deliver_wiki_content_updated(content) assert Mailer.wiki_content_updated(content).deliver
end end
end end
end end
@ -422,7 +422,7 @@ class MailerTest < ActiveSupport::TestCase
valid_languages.each do |lang| valid_languages.each do |lang|
user.update_attribute :language, lang.to_s user.update_attribute :language, lang.to_s
user.reload user.reload
assert Mailer.deliver_account_information(user, 'pAsswORd') assert Mailer.account_information(user, 'pAsswORd').deliver
end end
end end
@ -431,7 +431,7 @@ class MailerTest < ActiveSupport::TestCase
valid_languages.each do |lang| valid_languages.each do |lang|
token.user.update_attribute :language, lang.to_s token.user.update_attribute :language, lang.to_s
token.reload token.reload
assert Mailer.deliver_lost_password(token) assert Mailer.lost_password(token).deliver
end end
end end
@ -444,7 +444,7 @@ class MailerTest < ActiveSupport::TestCase
token.user.update_attribute :language, lang.to_s token.user.update_attribute :language, lang.to_s
token.reload token.reload
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
assert Mailer.deliver_register(token) assert Mailer.register(token).deliver
mail = last_email mail = last_email
assert_select_email do assert_select_email do
assert_select "a[href=?]", assert_select "a[href=?]",
@ -458,7 +458,7 @@ class MailerTest < ActiveSupport::TestCase
user = User.find(1) user = User.find(1)
valid_languages.each do |lang| valid_languages.each do |lang|
user.update_attribute :language, lang.to_s user.update_attribute :language, lang.to_s
assert Mailer.deliver_test_email(user) assert Mailer.test_email(user).deliver
end end
end end
@ -504,7 +504,7 @@ class MailerTest < ActiveSupport::TestCase
# Send an email to a french user # Send an email to a french user
user = User.find(1) user = User.find(1)
user.language = 'fr' user.language = 'fr'
Mailer.deliver_account_activated(user) Mailer.account_activated(user).deliver
mail = last_email mail = last_email
assert_mail_body_match 'Votre compte', mail assert_mail_body_match 'Votre compte', mail
@ -513,7 +513,7 @@ class MailerTest < ActiveSupport::TestCase
def test_with_deliveries_off def test_with_deliveries_off
Mailer.with_deliveries false do Mailer.with_deliveries false do
Mailer.deliver_test_email(User.find(1)) Mailer.test_email(User.find(1)).deliver
end end
assert ActionMailer::Base.deliveries.empty? assert ActionMailer::Base.deliveries.empty?
# should restore perform_deliveries # should restore perform_deliveries
@ -522,7 +522,7 @@ class MailerTest < ActiveSupport::TestCase
def test_layout_should_include_the_emails_header def test_layout_should_include_the_emails_header
with_settings :emails_header => "*Header content*" do with_settings :emails_header => "*Header content*" do
assert Mailer.deliver_test_email(User.find(1)) assert Mailer.test_email(User.find(1)).deliver
assert_select_email do assert_select_email do
assert_select ".header" do assert_select ".header" do
assert_select "strong", :text => "Header content" assert_select "strong", :text => "Header content"