summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_nested_set_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-01 18:42:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-01 18:42:41 +0000
commit6550ef9df55f8f6cc1422e33c310d2e274fd456a (patch)
tree4bd49c1d4870a8ce8e59ac5a41c9cea029fc932e /test/unit/issue_nested_set_test.rb
parentb972b5a647cae4cef4dfeb9686cb529705886107 (diff)
downloadredmine-6550ef9df55f8f6cc1422e33c310d2e274fd456a.tar.gz
redmine-6550ef9df55f8f6cc1422e33c310d2e274fd456a.zip
Fixed: deleting a parent issue may lead to a stale object error (#7920).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5285 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_nested_set_test.rb')
-rw-r--r--test/unit/issue_nested_set_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index cf61cfdea..46f4dc4dd 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -223,6 +223,16 @@ class IssueNestedSetTest < ActiveSupport::TestCase
assert_equal [issue1.id, 2, 3], [issue4.root_id, issue4.lft, issue4.rgt]
end
+ def test_destroy_parent_issue_updated_during_children_destroy
+ parent = create_issue!
+ create_issue!(:start_date => Date.today, :parent_issue_id => parent.id)
+ create_issue!(:start_date => 2.days.from_now, :parent_issue_id => parent.id)
+
+ assert_difference 'Issue.count', -3 do
+ Issue.find(parent.id).destroy
+ end
+ end
+
def test_destroy_child_issue_with_children
root = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'root')
child = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => root.id)