##// END OF EJS Templates
fix error of AdminControllerTest test_test_email_failure_should_display_the_error...
Toshi MARUYAMA -
r9458:f08b648ccee6
parent child
Show More
@@ -20,9 +20,23 require File.expand_path('../../test_helper', __FILE__)
20 class AdminControllerTest < ActionController::TestCase
20 class AdminControllerTest < ActionController::TestCase
21 fixtures :projects, :users, :roles
21 fixtures :projects, :users, :roles
22
22
23 class TestDelivery
24 def initialize(*)
25 end
26
27 def deliver!(mail)
28 raise 'Some error message'
29 end
30 end
31
23 def setup
32 def setup
24 User.current = nil
33 User.current = nil
25 @request.session[:user_id] = 1 # admin
34 @request.session[:user_id] = 1 # admin
35 @old_delivery_method = ActionMailer::Base.delivery_method
36 end
37
38 def teardown
39 ActionMailer::Base.delivery_method = @old_delivery_method
26 end
40 end
27
41
28 def test_index
42 def test_index
@@ -98,7 +112,7 class AdminControllerTest < ActionController::TestCase
98 end
112 end
99
113
100 def test_test_email_failure_should_display_the_error
114 def test_test_email_failure_should_display_the_error
101 Mailer.stubs(:deliver_test_email).raises(Exception, 'Some error message')
115 ActionMailer::Base.delivery_method = TestDelivery
102 get :test_email
116 get :test_email
103 assert_redirected_to '/settings/edit?tab=notifications'
117 assert_redirected_to '/settings/edit?tab=notifications'
104 assert_match /Some error message/, flash[:error]
118 assert_match /Some error message/, flash[:error]
General Comments 0
You need to be logged in to leave comments. Login now