summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_subtasking_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-06-08 15:40:45 +0000
committerGo MAEDA <maeda@farend.jp>2022-06-08 15:40:45 +0000
commitaef5983bdde41260ea5ea128c9e5036173c69cc0 (patch)
tree6a8f28c77c6260349fc79ccbf86cffce7c50e4d0 /test/unit/issue_subtasking_test.rb
parent29fc81d93f274fb528ce63ae5785c60c1d43ae3e (diff)
downloadredmine-aef5983bdde41260ea5ea128c9e5036173c69cc0.tar.gz
redmine-aef5983bdde41260ea5ea128c9e5036173c69cc0.zip
The done ratio of a parent issue may not be 100% even if all subtasks have a done ratio of 100% (#37151).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@21626 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_subtasking_test.rb')
-rw-r--r--test/unit/issue_subtasking_test.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/unit/issue_subtasking_test.rb b/test/unit/issue_subtasking_test.rb
index 0c2ffaa4d..0710190fd 100644
--- a/test/unit/issue_subtasking_test.rb
+++ b/test/unit/issue_subtasking_test.rb
@@ -243,11 +243,18 @@ class IssueSubtaskingTest < ActiveSupport::TestCase
def test_done_ratio_of_parent_with_completed_children_should_not_be_99
with_settings :parent_issue_done_ratio => 'derived' do
- parent = Issue.generate!
- parent.generate_child!(:estimated_hours => 8.0, :done_ratio => 100)
- parent.generate_child!(:estimated_hours => 8.1, :done_ratio => 100)
+ parent1 = Issue.generate!
+ parent1.generate_child!(:estimated_hours => 8.0, :done_ratio => 100)
+ parent1.generate_child!(:estimated_hours => 8.1, :done_ratio => 100)
# (8.0 * 100 + 8.1 * 100) / (8.0 + 8.1) => 99.99999999999999
- assert_equal 100, parent.reload.done_ratio
+ assert_equal 100, parent1.reload.done_ratio
+
+ parent2 = Issue.generate!
+ parent2.generate_child!(:estimated_hours => 9.0, :done_ratio => 100)
+ 10.times do
+ parent2.generate_child!(:estimated_hours => 10.0, :done_ratio => 100)
+ end
+ assert_equal 100, parent2.reload.done_ratio
end
end