]> source.dussan.org Git - redmine.git/commitdiff
use with_settings at MailHandlerControllerTest#test_should_not_allow_with_api_disabled
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Dec 2020 13:20:34 +0000 (13:20 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 3 Dec 2020 13:20:34 +0000 (13:20 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20561 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/mail_handler_controller_test.rb

index ba576039d53c575f2658c6cc103517e547a6f7dd..eb2b1182d3ef4270a823b9cf92194e34da3d72a0 100644 (file)
@@ -122,16 +122,20 @@ class MailHandlerControllerTest < Redmine::ControllerTest
 
   def test_should_not_allow_with_api_disabled
     # Disable API
-    Setting.mail_handler_api_enabled = 0
-    Setting.mail_handler_api_key = 'secret'
-    assert_no_difference 'Issue.count' do
-      post(
-        :index,
-        :params => {
-          :key => 'secret',
-          :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
-        }
-      )
+    with_settings(
+      :mail_handler_api_enabled => 0,
+      :mail_handler_api_key => 'secret'
+    ) do
+      assert_no_difference 'Issue.count' do
+        post(
+          :index,
+          :params => {
+            :key => 'secret',
+            :email =>
+              IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
+          }
+        )
+      end
     end
     assert_response 403
     assert_include 'Access denied', response.body