]> source.dussan.org Git - redmine.git/commitdiff
Test for #14798.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 11 Sep 2013 22:00:40 +0000 (22:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 11 Sep 2013 22:00:40 +0000 (22:00 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12132 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/issue_nested_set_test.rb

index 0d83671e00df45507509c2a792e28576231d69af..3a53eb3af6c4d5ffca52a4f4f85ac4c1dcf54ab8 100644 (file)
@@ -302,6 +302,17 @@ class IssueNestedSetTest < ActiveSupport::TestCase
     assert_equal (50 * 20 + 20 * 10) / 30, parent.reload.done_ratio
   end
 
+  def test_parent_done_ratio_with_child_estimate_to_0_should_reach_100
+    parent = Issue.generate!
+    issue1 = Issue.generate!(:parent_issue_id => parent.id)
+    issue2 = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 0)
+    assert_equal 0, parent.reload.done_ratio
+    issue1.reload.update_attribute :status_id, 5
+    assert_equal 50, parent.reload.done_ratio
+    issue2.reload.update_attribute :status_id, 5
+    assert_equal 100, parent.reload.done_ratio
+  end
+
   def test_parent_estimate_should_be_sum_of_leaves
     parent = Issue.generate!
     Issue.generate!(:estimated_hours => nil, :parent_issue_id => parent.id)