diff options
Diffstat (limited to 'test/unit/issue_nested_set_test.rb')
-rw-r--r-- | test/unit/issue_nested_set_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb index 88f65d3f6..4062839a3 100644 --- a/test/unit/issue_nested_set_test.rb +++ b/test/unit/issue_nested_set_test.rb @@ -306,4 +306,23 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert_equal ic2, ic4.parent assert ic5.root? end + + def test_rebuild_single_tree + i1 = Issue.generate! + i2 = i1.generate_child! + i3 = i1.generate_child! + Issue.update_all(:lft => 7, :rgt => 7) + + Issue.rebuild_single_tree!(i1.id) + + i1.reload + assert_equal [1, 6], [i1.lft, i1.rgt] + i2.reload + assert_equal [2, 3], [i2.lft, i2.rgt] + i3.reload + assert_equal [4, 5], [i3.lft, i3.rgt] + + other = Issue.find(1) + assert_equal [7, 7], [other.lft, other.rgt] + end end |