summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-18 17:16:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-18 17:16:13 +0000
commitf62507dae53a7eb5880322e03dbf0f0a49e3d311 (patch)
treebe95c1446f7f95fdc086f1f72d1896a513cb0a7a /test/unit/project_test.rb
parent9e878a938438337f6c2ea0d96f3f05031906afc8 (diff)
downloadredmine-f62507dae53a7eb5880322e03dbf0f0a49e3d311.tar.gz
redmine-f62507dae53a7eb5880322e03dbf0f0a49e3d311.zip
Fixed that deleting a project with subtasks may fail (#11185).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9858 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 39ed5d058..64a2631ea 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -190,6 +190,18 @@ class ProjectTest < ActiveSupport::TestCase
assert_nil Issue.first(:conditions => {:project_id => @ecookbook.id})
end
+ def test_destroy_should_destroy_subtasks
+ issues = (0..2).to_a.map {Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test')}
+ issues[0].update_attribute :parent_issue_id, issues[1].id
+ issues[2].update_attribute :parent_issue_id, issues[1].id
+ assert_equal 2, issues[1].children.count
+
+ assert_nothing_raised do
+ Project.find(1).destroy
+ end
+ assert Issue.find_all_by_id(issues.map(&:id)).empty?
+ end
+
def test_destroying_root_projects_should_clear_data
Project.roots.each do |root|
root.destroy