##// END OF EJS Templates
Renamed Mailer#test to Mailer#test_email....
Jean-Philippe Lang -
r8960:d862843c9d58
parent child
Show More
@@ -63,7 +63,7 class AdminController < ApplicationController
63 # Force ActionMailer to raise delivery errors so we can catch it
63 # Force ActionMailer to raise delivery errors so we can catch it
64 ActionMailer::Base.raise_delivery_errors = true
64 ActionMailer::Base.raise_delivery_errors = true
65 begin
65 begin
66 @test = Mailer.deliver_test(User.current)
66 @test = Mailer.deliver_test_email(User.current)
67 flash[:notice] = l(:notice_email_sent, User.current.mail)
67 flash[:notice] = l(:notice_email_sent, User.current.mail)
68 rescue Exception => e
68 rescue Exception => e
69 flash[:error] = l(:notice_email_error, e.message)
69 flash[:error] = l(:notice_email_error, e.message)
@@ -290,12 +290,12 class Mailer < ActionMailer::Base
290 render_multipart('register', body)
290 render_multipart('register', body)
291 end
291 end
292
292
293 def test(user)
293 def test_email(user)
294 set_language_if_valid(user.language)
294 set_language_if_valid(user.language)
295 recipients user.mail
295 recipients user.mail
296 subject 'Redmine test'
296 subject 'Redmine test'
297 body :url => url_for(:controller => 'welcome')
297 body :url => url_for(:controller => 'welcome')
298 render_multipart('test', body)
298 render_multipart('test_email', body)
299 end
299 end
300
300
301 # Overrides default deliver! method to prevent from sending an email
301 # Overrides default deliver! method to prevent from sending an email
1 NO CONTENT: file renamed from app/views/mailer/test.html.erb to app/views/mailer/test_email.html.erb
NO CONTENT: file renamed from app/views/mailer/test.html.erb to app/views/mailer/test_email.html.erb
1 NO CONTENT: file renamed from app/views/mailer/test.text.erb to app/views/mailer/test_email.text.erb
NO CONTENT: file renamed from app/views/mailer/test.text.erb to app/views/mailer/test_email.text.erb
@@ -176,7 +176,7 END_DESC
176
176
177 ActionMailer::Base.raise_delivery_errors = true
177 ActionMailer::Base.raise_delivery_errors = true
178 begin
178 begin
179 Mailer.deliver_test(User.current)
179 Mailer.deliver_test_email(User.current)
180 puts l(:notice_email_sent, user.mail)
180 puts l(:notice_email_sent, user.mail)
181 rescue Exception => e
181 rescue Exception => e
182 abort l(:notice_email_error, e.message)
182 abort l(:notice_email_error, e.message)
@@ -91,7 +91,7 class AdminControllerTest < ActionController::TestCase
91 end
91 end
92
92
93 def test_test_email_failure_should_display_the_error
93 def test_test_email_failure_should_display_the_error
94 Mailer.stubs(:deliver_test).raises(Exception, 'Some error message')
94 Mailer.stubs(:deliver_test_email).raises(Exception, 'Some error message')
95 get :test_email
95 get :test_email
96 assert_redirected_to '/settings/edit?tab=notifications'
96 assert_redirected_to '/settings/edit?tab=notifications'
97 assert_match /Some error message/, flash[:error]
97 assert_match /Some error message/, flash[:error]
@@ -196,7 +196,7 class MailerTest < ActiveSupport::TestCase
196
196
197 def test_from_header
197 def test_from_header
198 with_settings :mail_from => 'redmine@example.net' do
198 with_settings :mail_from => 'redmine@example.net' do
199 Mailer.deliver_test(User.find(1))
199 Mailer.deliver_test_email(User.find(1))
200 end
200 end
201 mail = last_email
201 mail = last_email
202 assert_equal 'redmine@example.net', mail.from_addrs.first.address
202 assert_equal 'redmine@example.net', mail.from_addrs.first.address
@@ -204,7 +204,7 class MailerTest < ActiveSupport::TestCase
204
204
205 def test_from_header_with_phrase
205 def test_from_header_with_phrase
206 with_settings :mail_from => 'Redmine app <redmine@example.net>' do
206 with_settings :mail_from => 'Redmine app <redmine@example.net>' do
207 Mailer.deliver_test(User.find(1))
207 Mailer.deliver_test_email(User.find(1))
208 end
208 end
209 mail = last_email
209 mail = last_email
210 assert_equal 'redmine@example.net', mail.from_addrs.first.address
210 assert_equal 'redmine@example.net', mail.from_addrs.first.address
@@ -461,7 +461,7 class MailerTest < ActiveSupport::TestCase
461 user = User.find(1)
461 user = User.find(1)
462 valid_languages.each do |lang|
462 valid_languages.each do |lang|
463 user.update_attribute :language, lang.to_s
463 user.update_attribute :language, lang.to_s
464 assert Mailer.deliver_test(user)
464 assert Mailer.deliver_test_email(user)
465 end
465 end
466 end
466 end
467
467
@@ -522,7 +522,7 class MailerTest < ActiveSupport::TestCase
522
522
523 def test_with_deliveries_off
523 def test_with_deliveries_off
524 Mailer.with_deliveries false do
524 Mailer.with_deliveries false do
525 Mailer.deliver_test(User.find(1))
525 Mailer.deliver_test_email(User.find(1))
526 end
526 end
527 assert ActionMailer::Base.deliveries.empty?
527 assert ActionMailer::Base.deliveries.empty?
528 # should restore perform_deliveries
528 # should restore perform_deliveries
@@ -539,7 +539,7 class MailerTest < ActiveSupport::TestCase
539
539
540 def test_layout_should_include_the_emails_header
540 def test_layout_should_include_the_emails_header
541 with_settings :emails_header => "*Header content*" do
541 with_settings :emails_header => "*Header content*" do
542 assert Mailer.deliver_test(User.find(1))
542 assert Mailer.deliver_test_email(User.find(1))
543 assert_select_email do
543 assert_select_email do
544 assert_select ".header" do
544 assert_select ".header" do
545 assert_select "strong", :text => "Header content"
545 assert_select "strong", :text => "Header content"
General Comments 0
You need to be logged in to leave comments. Login now