summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_nested_set_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-01-31 17:42:46 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-01-31 17:42:46 +0000
commit888823a449d9694060a22c09d8d73b2f652e62bb (patch)
tree2532098d52e6ab32dd9d697669f9ff2efe5e7938 /test/unit/issue_nested_set_test.rb
parente699458b3cc15e086919c468b9ab6e9a3403b4e1 (diff)
downloadredmine-888823a449d9694060a22c09d8d73b2f652e62bb.tar.gz
redmine-888823a449d9694060a22c09d8d73b2f652e62bb.zip
Fixed calculation of done_ratio of parent task with child having estimated_time at 0 (#15870).
git-svn-id: http://svn.redmine.org/redmine/trunk@12745 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_nested_set_test.rb')
-rw-r--r--test/unit/issue_nested_set_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb
index 8c40f895c..4a41c49db 100644
--- a/test/unit/issue_nested_set_test.rb
+++ b/test/unit/issue_nested_set_test.rb
@@ -368,6 +368,18 @@ class IssueNestedSetTest < ActiveSupport::TestCase
assert_equal 100, parent.reload.done_ratio
end
+ def test_done_ratio_of_parent_with_a_child_with_estimated_time_at_0_should_not_exceed_100
+ parent = Issue.generate!
+ Issue.generate!(:estimated_hours => 40, :parent_issue_id => parent.id)
+ Issue.generate!(:estimated_hours => 40, :parent_issue_id => parent.id)
+ Issue.generate!(:estimated_hours => 20, :parent_issue_id => parent.id)
+ Issue.generate!(:estimated_hours => 0, :parent_issue_id => parent.id)
+ parent.reload.children.each do |child|
+ child.update_attribute :status_id, 5
+ end
+ assert_equal 100, parent.reload.done_ratio
+ end
+
def test_move_parent_updates_old_parent_attributes
first_parent = Issue.generate!
second_parent = Issue.generate!