summaryrefslogtreecommitdiffstats
path: root/test/functional/projects_controller_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-12-10 01:09:33 +0000
committerGo MAEDA <maeda@farend.jp>2020-12-10 01:09:33 +0000
commit586ff28733388da6a6d944af081228f3b21b8607 (patch)
treef98c5f57f1643f41059550813b9e61ac140528f9 /test/functional/projects_controller_test.rb
parent086c95569e629b47049e308f627916df7182fb5f (diff)
downloadredmine-586ff28733388da6a6d944af081228f3b21b8607.tar.gz
redmine-586ff28733388da6a6d944af081228f3b21b8607.zip
Require to enter project's identifier to confirm project deletion (#34417).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@20601 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/projects_controller_test.rb')
-rw-r--r--test/functional/projects_controller_test.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 8d20704de..c7329b2e5 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -1028,6 +1028,16 @@ class ProjectsControllerTest < Redmine::ControllerTest
assert_select '.warning', :text => /Are you sure you want to delete this project/
end
+ def test_destroy_leaf_project_with_wrong_confirmation_should_show_confirmation
+ @request.session[:user_id] = 1 # admin
+
+ assert_no_difference 'Project.count' do
+ delete(:destroy, :params => {:id => 2, :confirm => 'wrong'})
+ assert_response :success
+ end
+ assert_select '.warning', :text => /Are you sure you want to delete this project/
+ end
+
def test_destroy_without_confirmation_should_show_confirmation_with_subprojects
set_tmp_attachments_directory
@request.session[:user_id] = 1 # admin
@@ -1051,7 +1061,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
:destroy,
:params => {
:id => 1,
- :confirm => 1
+ :confirm => 'ecookbook'
}
)
assert_redirected_to '/admin/projects'
@@ -1068,7 +1078,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
:destroy,
:params => {
:id => 2,
- :confirm => 1
+ :confirm => 'onlinestore'
}
)
assert_redirected_to '/projects'
@@ -1085,7 +1095,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
:destroy,
:params => {
:id => 1,
- :confirm => 1
+ :confirm => 'ecookbook'
}
)
assert_response 403