diff test/unit/issue_nested_set_test.rb @ 1494:e248c7af89ec redmine-2.4

Update to Redmine SVN revision 12979 on 2.4-stable branch
author Chris Cannam
date Mon, 17 Mar 2014 08:54:02 +0000
parents 261b3d9a4903
children dffacf8a6908
line wrap: on
line diff
--- a/test/unit/issue_nested_set_test.rb	Tue Jan 14 14:37:42 2014 +0000
+++ b/test/unit/issue_nested_set_test.rb	Mon Mar 17 08:54:02 2014 +0000
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2013  Jean-Philippe Lang
+# Copyright (C) 2006-2014  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -358,6 +358,18 @@
     assert_equal 12, parent.reload.estimated_hours
   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!