summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-30 02:45:34 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-30 02:45:34 +0000
commitc6201ae15b4fcb8ca17dbe39636e6efa626d7a03 (patch)
treecbf8362f615c7e4d6e1b3bbe76455708cb8a581e /test
parent305cab100fe195ef24731b485c8c83030aaa4e29 (diff)
downloadredmine-c6201ae15b4fcb8ca17dbe39636e6efa626d7a03.tar.gz
redmine-c6201ae15b4fcb8ca17dbe39636e6efa626d7a03.zip
Recalculate inherited attributes on parents when a child is moved under a new parent. #5524
Contributed by Jean-Baptiste Barth. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3821 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_nested_set_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index 7138e4527..cda8c4e58 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -273,6 +273,15 @@ class IssueNestedSetTest < ActiveSupport::TestCase
assert_equal 12, parent.reload.estimated_hours
end
+ def test_move_parent_updates_old_parent_attributes
+ first_parent = create_issue!
+ second_parent = create_issue!
+ child = create_issue!(:estimated_hours => 5, :parent_issue_id => first_parent.id)
+ assert_equal 5, first_parent.reload.estimated_hours
+ child.update_attributes(:estimated_hours => 7, :parent_issue_id => second_parent.id)
+ assert_equal 7, second_parent.reload.estimated_hours
+ assert_nil first_parent.reload.estimated_hours
+ end
def test_reschuling_a_parent_should_reschedule_subtasks
parent = create_issue!