##// END OF EJS Templates
Fixed: deleting a parent issue may lead to a stale object error (#7920)....
Jean-Philippe Lang -
r5165:6550ef9df55f
parent child
Show More
@@ -223,6 +223,16 class IssueNestedSetTest < ActiveSupport::TestCase
223 223 assert_equal [issue1.id, 2, 3], [issue4.root_id, issue4.lft, issue4.rgt]
224 224 end
225 225
226 def test_destroy_parent_issue_updated_during_children_destroy
227 parent = create_issue!
228 create_issue!(:start_date => Date.today, :parent_issue_id => parent.id)
229 create_issue!(:start_date => 2.days.from_now, :parent_issue_id => parent.id)
230
231 assert_difference 'Issue.count', -3 do
232 Issue.find(parent.id).destroy
233 end
234 end
235
226 236 def test_destroy_child_issue_with_children
227 237 root = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'root')
228 238 child = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => root.id)
@@ -466,6 +466,9 module CollectiveIdea #:nodoc:
466 466 ["#{quoted_right_column_name} >= ?", right]
467 467 )
468 468 end
469
470 # Reload is needed because children may have updated their parent (self) during deletion.
471 reload
469 472 end
470 473
471 474 # reload left, right, and parent
General Comments 0
You need to be logged in to leave comments. Login now