@@ -20,23 +20,9 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 | ||
|
32 | 23 | def setup |
|
33 | 24 | User.current = nil |
|
34 | 25 | @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 | |
|
40 | 26 | end |
|
41 | 27 | |
|
42 | 28 | def test_index |
@@ -112,7 +98,7 class AdminControllerTest < ActionController::TestCase | |||
|
112 | 98 | end |
|
113 | 99 | |
|
114 | 100 | def test_test_email_failure_should_display_the_error |
|
115 | ActionMailer::Base.delivery_method = TestDelivery | |
|
101 | Mailer.stubs(:test_email).raises(Exception, 'Some error message') | |
|
116 | 102 | get :test_email |
|
117 | 103 | assert_redirected_to '/settings/edit?tab=notifications' |
|
118 | 104 | assert_match /Some error message/, flash[:error] |
General Comments 0
You need to be logged in to leave comments.
Login now