summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-24 08:35:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-24 08:35:48 +0000
commit9957883c4ddf53cbbee40e8c952f0a7aa0d703ca (patch)
tree618444925c1aa49f703f743497195e684198de29 /test/unit
parentd0889f9127c67fe6e8b604c8e259961dded9282b (diff)
downloadredmine-9957883c4ddf53cbbee40e8c952f0a7aa0d703ca.tar.gz
redmine-9957883c4ddf53cbbee40e8c952f0a7aa0d703ca.zip
Fixed: Error deleting issue with grandchild (#8880).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6311 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_nested_set_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index 6cbc44461..103787a00 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -252,6 +252,20 @@ class IssueNestedSetTest < ActiveSupport::TestCase
root = Issue.find(root.id)
assert root.leaf?, "Root issue is not a leaf (lft: #{root.lft}, rgt: #{root.rgt})"
end
+
+ def test_destroy_issue_with_grand_child
+ parent = create_issue!
+ issue = create_issue!(:parent_issue_id => parent.id)
+ child = create_issue!(:parent_issue_id => issue.id)
+ grandchild1 = create_issue!(:parent_issue_id => child.id)
+ grandchild2 = create_issue!(:parent_issue_id => child.id)
+
+ assert_difference 'Issue.count', -4 do
+ Issue.find(issue.id).destroy
+ parent.reload
+ assert_equal [1, 2], [parent.lft, parent.rgt]
+ end
+ end
def test_parent_priority_should_be_the_highest_child_priority
parent = create_issue!(:priority => IssuePriority.find_by_name('Normal'))