summaryrefslogtreecommitdiffstats
path: root/test/functional/mail_handler_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-11-24 13:19:17 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-11-24 13:19:17 +0000
commitc20f1d0aaa107c0e1665f2a93e6dcfafd905d806 (patch)
tree1fcf36c92b2aca0fb6260d303c1fde1bffae964e /test/functional/mail_handler_controller_test.rb
parent9d48754b32fab9938a54e39f3d4a6c42ab10e1ba (diff)
downloadredmine-c20f1d0aaa107c0e1665f2a93e6dcfafd905d806.tar.gz
redmine-c20f1d0aaa107c0e1665f2a93e6dcfafd905d806.zip
cleanup: rubocop: fix Layout/IndentFirstHashElement in test/functional/mail_handler_controller_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19258 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/mail_handler_controller_test.rb')
-rw-r--r--test/functional/mail_handler_controller_test.rb40
1 files changed, 25 insertions, 15 deletions
diff --git a/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb
index 6fb0a6913..a669a6cd5 100644
--- a/test/functional/mail_handler_controller_test.rb
+++ b/test/functional/mail_handler_controller_test.rb
@@ -35,10 +35,13 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_key = 'secret'
assert_difference 'Issue.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
}
+ )
end
assert_response 201
end
@@ -47,15 +50,17 @@ class MailHandlerControllerTest < Redmine::ControllerTest
# Enable API and set a key
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
-
assert_difference 'Issue.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')),
:issue => {
:is_private => '1'
}
}
+ )
end
assert_response 201
issue = Issue.order(:id => :desc).first
@@ -66,13 +71,15 @@ class MailHandlerControllerTest < Redmine::ControllerTest
# Enable API and set a key
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
-
assert_no_difference 'Issue.count' do
assert_difference 'Journal.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_reply.eml'))
}
+ )
end
end
assert_response 201
@@ -83,12 +90,14 @@ class MailHandlerControllerTest < Redmine::ControllerTest
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
-
assert_no_difference 'Issue.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
}
+ )
end
assert_response 422
end
@@ -97,12 +106,14 @@ class MailHandlerControllerTest < Redmine::ControllerTest
# Disable API
Setting.mail_handler_api_enabled = 0
Setting.mail_handler_api_key = 'secret'
-
assert_no_difference 'Issue.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
}
+ )
end
assert_response 403
assert_include 'Access denied', response.body
@@ -111,12 +122,14 @@ class MailHandlerControllerTest < Redmine::ControllerTest
def test_should_not_allow_with_wrong_key
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
-
assert_no_difference 'Issue.count' do
- post :index, :params => {
+ post(
+ :index,
+ :params => {
:key => 'wrong',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
}
+ )
end
assert_response 403
assert_include 'Access denied', response.body
@@ -125,10 +138,7 @@ class MailHandlerControllerTest < Redmine::ControllerTest
def test_new
Setting.mail_handler_api_enabled = 1
Setting.mail_handler_api_key = 'secret'
-
- get :new, :params => {
- :key => 'secret'
- }
+ get(:new, :params => {:key => 'secret'})
assert_response :success
end
end