diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-29 09:07:40 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-29 09:07:40 +0000 |
commit | 32022267affaf9fb0fd831e030b632ffdea9c100 (patch) | |
tree | 8623180dedf65a7e19273d3ce24942e4aeffc6c7 | |
parent | f078f7127c4521d196e82dc648866525767d5178 (diff) | |
download | redmine-32022267affaf9fb0fd831e030b632ffdea9c100.tar.gz redmine-32022267affaf9fb0fd831e030b632ffdea9c100.zip |
Merged r5285 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@5591 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | test/unit/issue_nested_set_test.rb | 10 | ||||
-rw-r--r-- | vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb | 3 |
2 files changed, 13 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) diff --git a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb index fc5278d69..b2ebd669c 100644 --- a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb +++ b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb @@ -466,6 +466,9 @@ module CollectiveIdea #:nodoc: ["#{quoted_right_column_name} >= ?", right] ) end + + # Reload is needed because children may have updated their parent (self) during deletion. + reload end # reload left, right, and parent |