Renamed Mailer#test to Mailer#test_email.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9080 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-03-04 12:38:34 +00:00
parent 1b923819e8
commit d862843c9d
7 changed files with 10 additions and 10 deletions

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(User.current) @test = Mailer.deliver_test_email(User.current)
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

@ -290,12 +290,12 @@ class Mailer < ActionMailer::Base
render_multipart('register', body) render_multipart('register', body)
end end
def test(user) def test_email(user)
set_language_if_valid(user.language) set_language_if_valid(user.language)
recipients user.mail recipients user.mail
subject 'Redmine test' subject 'Redmine test'
body :url => url_for(:controller => 'welcome') body :url => url_for(:controller => 'welcome')
render_multipart('test', body) render_multipart('test_email', body)
end end
# Overrides default deliver! method to prevent from sending an email # Overrides default deliver! method to prevent from sending an email

View File

@ -176,7 +176,7 @@ END_DESC
ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.raise_delivery_errors = true
begin begin
Mailer.deliver_test(User.current) Mailer.deliver_test_email(User.current)
puts l(:notice_email_sent, user.mail) puts l(:notice_email_sent, user.mail)
rescue Exception => e rescue Exception => e
abort l(:notice_email_error, e.message) abort l(:notice_email_error, e.message)

View File

@ -91,7 +91,7 @@ class AdminControllerTest < ActionController::TestCase
end end
def test_test_email_failure_should_display_the_error def test_test_email_failure_should_display_the_error
Mailer.stubs(:deliver_test).raises(Exception, 'Some error message') Mailer.stubs(:deliver_test_email).raises(Exception, 'Some error message')
get :test_email get :test_email
assert_redirected_to '/settings/edit?tab=notifications' assert_redirected_to '/settings/edit?tab=notifications'
assert_match /Some error message/, flash[:error] assert_match /Some error message/, flash[:error]

View File

@ -196,7 +196,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(User.find(1)) Mailer.deliver_test_email(User.find(1))
end end
mail = last_email mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first.address assert_equal 'redmine@example.net', mail.from_addrs.first.address
@ -204,7 +204,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(User.find(1)) Mailer.deliver_test_email(User.find(1))
end end
mail = last_email mail = last_email
assert_equal 'redmine@example.net', mail.from_addrs.first.address assert_equal 'redmine@example.net', mail.from_addrs.first.address
@ -461,7 +461,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(user) assert Mailer.deliver_test_email(user)
end end
end end
@ -522,7 +522,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(User.find(1)) Mailer.deliver_test_email(User.find(1))
end end
assert ActionMailer::Base.deliveries.empty? assert ActionMailer::Base.deliveries.empty?
# should restore perform_deliveries # should restore perform_deliveries
@ -539,7 +539,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(User.find(1)) assert Mailer.deliver_test_email(User.find(1))
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"