diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-05-17 20:50:37 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-05-17 20:50:37 +0000 |
commit | e1d6bfbdcc1de030a4ae59e6f5a80f3d003cabe0 (patch) | |
tree | 31683b98b2301e7bbd89059edcba8489258ab95f /test/functional | |
parent | 883aa3b5cca1645f2aae353f4f180f77c5693c7e (diff) | |
download | redmine-e1d6bfbdcc1de030a4ae59e6f5a80f3d003cabe0.tar.gz redmine-e1d6bfbdcc1de030a4ae59e6f5a80f3d003cabe0.zip |
Adds projects bulk delete (#36691).
Patch by Jens Krämer.
git-svn-id: https://svn.redmine.org/redmine/trunk@21592 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/projects_controller_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 411496f0d..07f590365 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -1227,6 +1227,31 @@ class ProjectsControllerTest < Redmine::ControllerTest assert Project.find(1) end + def test_bulk_destroy_should_require_admin + @request.session[:user_id] = 2 # non-admin + delete :bulk_destroy, params: { ids: [1, 2], confirm: 'Yes' } + assert_response 403 + end + + def test_bulk_destroy_should_require_confirmation + @request.session[:user_id] = 1 # admin + assert_difference 'Project.count', 0 do + delete :bulk_destroy, params: { ids: [1, 2] } + end + assert Project.find(1) + assert Project.find(2) + assert_response 200 + end + + def test_bulk_destroy_should_delete_projects + @request.session[:user_id] = 1 # admin + assert_difference 'Project.count', -2 do + delete :bulk_destroy, params: { ids: [2, 6], confirm: 'Yes' } + end + assert_equal 0, Project.where(id: [2, 6]).count + assert_redirected_to '/admin/projects' + end + def test_archive @request.session[:user_id] = 1 # admin post(:archive, :params => {:id => 1}) |