##// 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 20 class AdminControllerTest < ActionController::TestCase
21 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 32 def setup
24 33 User.current = nil
25 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 40 end
27 41
28 42 def test_index
@@ -98,7 +112,7 class AdminControllerTest < ActionController::TestCase
98 112 end
99 113
100 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 116 get :test_email
103 117 assert_redirected_to '/settings/edit?tab=notifications'
104 118 assert_match /Some error message/, flash[:error]
General Comments 0
You need to be logged in to leave comments. Login now