summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-11-14 09:58:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-11-14 09:58:52 +0000
commit1a860d5320aa192baa886810653f7019fe077602 (patch)
tree8359633c61ebd68e40f1c6b8bc7ba0bc5732d979 /test/unit
parent5735db1a9154ba73fbe28d726450dc6895506c0e (diff)
downloadredmine-1a860d5320aa192baa886810653f7019fe077602.tar.gz
redmine-1a860d5320aa192baa886810653f7019fe077602.zip
Calculate done_ratio based on children instead of leaves (#20995).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@14875 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_subtasking_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/issue_subtasking_test.rb b/test/unit/issue_subtasking_test.rb
index 7814d34b1..cadfe6644 100644
--- a/test/unit/issue_subtasking_test.rb
+++ b/test/unit/issue_subtasking_test.rb
@@ -185,6 +185,26 @@ class IssueSubtaskingTest < ActiveSupport::TestCase
end
end
+ def test_done_ratio_of_parent_should_reflect_children
+ root = Issue.generate!
+ child1 = root.generate_child!
+ child2 = child1.generate_child!
+
+ assert_equal 0, root.done_ratio
+ assert_equal 0, child1.done_ratio
+ assert_equal 0, child2.done_ratio
+
+ with_settings :issue_done_ratio => 'issue_status' do
+ status = IssueStatus.find(4)
+ status.update_attribute :default_done_ratio, 50
+ child1.update_attribute :status, status
+
+ assert_equal 50, child1.done_ratio
+ root.reload
+ assert_equal 50, root.done_ratio
+ end
+ end
+
def test_parent_dates_should_be_editable_with_parent_issue_dates_set_to_independent
with_settings :parent_issue_dates => 'independent' do
issue = Issue.generate_with_child!