summaryrefslogtreecommitdiffstats
path: root/test/functional/admin_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-05-05 14:34:16 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-05-05 14:34:16 +0000
commitf08b648ccee66d141b90fd35bf688c98cd7f14da (patch)
treefef654608d7dae0242d56e11e073287cf86bdd07 /test/functional/admin_controller_test.rb
parent19e56045dd7c3321026d6e1fe2f0dd23ceecf5ff (diff)
downloadredmine-f08b648ccee66d141b90fd35bf688c98cd7f14da.tar.gz
redmine-f08b648ccee66d141b90fd35bf688c98cd7f14da.zip
fix error of AdminControllerTest test_test_email_failure_should_display_the_error
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9641 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/admin_controller_test.rb')
-rw-r--r--test/functional/admin_controller_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index 981376105..f837b5063 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -20,9 +20,23 @@ require File.expand_path('../../test_helper', __FILE__)
class AdminControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles
+ class TestDelivery
+ def initialize(*)
+ end
+
+ def deliver!(mail)
+ raise 'Some error message'
+ end
+ end
+
def setup
User.current = nil
@request.session[:user_id] = 1 # admin
+ @old_delivery_method = ActionMailer::Base.delivery_method
+ end
+
+ def teardown
+ ActionMailer::Base.delivery_method = @old_delivery_method
end
def test_index
@@ -98,7 +112,7 @@ class AdminControllerTest < ActionController::TestCase
end
def test_test_email_failure_should_display_the_error
- Mailer.stubs(:deliver_test_email).raises(Exception, 'Some error message')
+ ActionMailer::Base.delivery_method = TestDelivery
get :test_email
assert_redirected_to '/settings/edit?tab=notifications'
assert_match /Some error message/, flash[:error]