mirror of
https://github.com/redmine/redmine.git
synced 2025-11-07 13:55:52 +01:00
Fix that deleting a closed or archived projects not working anymore after r20034 (#35827).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@21210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1110,6 +1110,25 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
assert_nil Project.find_by_id(1)
|
||||
end
|
||||
|
||||
def test_destroy_should_destroy_archived_project
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 1 # admin
|
||||
|
||||
Project.find_by_id(2).update_attribute :status, Project::STATUS_ARCHIVED
|
||||
|
||||
assert_difference 'Project.count', -1 do
|
||||
delete(
|
||||
:destroy,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:confirm => 'onlinestore'
|
||||
}
|
||||
)
|
||||
assert_redirected_to '/admin/projects'
|
||||
end
|
||||
assert_nil Project.find_by_id(2)
|
||||
end
|
||||
|
||||
def test_destroy_with_normal_user_should_destroy
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2 # non-admin
|
||||
@@ -1127,6 +1146,25 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
assert_nil Project.find_by_id(2)
|
||||
end
|
||||
|
||||
def test_destroy_with_normal_user_should_destroy_closed_project
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2 # non-admin
|
||||
|
||||
Project.find_by_id(2).update_attribute :status, Project::STATUS_CLOSED
|
||||
|
||||
assert_difference 'Project.count', -1 do
|
||||
delete(
|
||||
:destroy,
|
||||
:params => {
|
||||
:id => 2,
|
||||
:confirm => 'onlinestore'
|
||||
}
|
||||
)
|
||||
assert_redirected_to '/projects'
|
||||
end
|
||||
assert_nil Project.find_by_id(2)
|
||||
end
|
||||
|
||||
def test_destroy_with_normal_user_should_not_destroy_with_subprojects
|
||||
set_tmp_attachments_directory
|
||||
@request.session[:user_id] = 2 # non-admin
|
||||
|
||||
Reference in New Issue
Block a user