summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-06 08:43:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-06 08:43:44 +0000
commitf6882cd69e65176b5fcedbe4058c0560bb178de2 (patch)
treed8378a7a00a336cfb730092e1c7b18a2c6dc2753 /test
parent18852b765a8a1715086cdb1b06d2f15680e56676 (diff)
downloadredmine-f6882cd69e65176b5fcedbe4058c0560bb178de2.tar.gz
redmine-f6882cd69e65176b5fcedbe4058c0560bb178de2.zip
Stub Mailer with mocha.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9645 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/admin_controller_test.rb16
1 files changed, 1 insertions, 15 deletions
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb
index f837b5063..94d0c32cf 100644
--- a/test/functional/admin_controller_test.rb
+++ b/test/functional/admin_controller_test.rb
@@ -20,23 +20,9 @@ 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
@@ -112,7 +98,7 @@ class AdminControllerTest < ActionController::TestCase
end
def test_test_email_failure_should_display_the_error
- ActionMailer::Base.delivery_method = TestDelivery
+ Mailer.stubs(:test_email).raises(Exception, 'Some error message')
get :test_email
assert_redirected_to '/settings/edit?tab=notifications'
assert_match /Some error message/, flash[:error]