##// END OF EJS Templates
fix unit VersionTest failure...
Toshi MARUYAMA -
r11638:de394f5f74e0
parent child
Show More
@@ -143,7 +143,7 class VersionTest < ActiveSupport::TestCase
143 end
143 end
144
144
145 test "#behind_schedule? should be false if all of the issues are ahead of schedule" do
145 test "#behind_schedule? should be false if all of the issues are ahead of schedule" do
146 version = Version.generate!(:effective_date => 7.days.from_now.to_date)
146 version = Version.create!(:project_id => 1, :name => 'test', :effective_date => 7.days.from_now.to_date)
147 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
147 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
148 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
148 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
149 assert_equal 60, version.completed_percent
149 assert_equal 60, version.completed_percent
@@ -151,7 +151,7 class VersionTest < ActiveSupport::TestCase
151 end
151 end
152
152
153 test "#behind_schedule? should be true if any of the issues are behind schedule" do
153 test "#behind_schedule? should be true if any of the issues are behind schedule" do
154 version = Version.generate!(:effective_date => 7.days.from_now.to_date)
154 version = Version.create!(:project_id => 1, :name => 'test', :effective_date => 7.days.from_now.to_date)
155 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
155 add_issue(version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
156 add_issue(version, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
156 add_issue(version, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
157 assert_equal 40, version.completed_percent
157 assert_equal 40, version.completed_percent
@@ -159,7 +159,7 class VersionTest < ActiveSupport::TestCase
159 end
159 end
160
160
161 test "#behind_schedule? should be false if all of the issues are complete" do
161 test "#behind_schedule? should be false if all of the issues are complete" do
162 version = Version.generate!(:effective_date => 7.days.from_now.to_date)
162 version = Version.create!(:project_id => 1, :name => 'test', :effective_date => 7.days.from_now.to_date)
163 add_issue(version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
163 add_issue(version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
164 add_issue(version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
164 add_issue(version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
165 assert_equal 100, version.completed_percent
165 assert_equal 100, version.completed_percent
@@ -172,20 +172,20 class VersionTest < ActiveSupport::TestCase
172 end
172 end
173
173
174 test "#estimated_hours should return 0 with no estimated hours" do
174 test "#estimated_hours should return 0 with no estimated hours" do
175 version = Version.generate!
175 version = Version.create!(:project_id => 1, :name => 'test')
176 add_issue(version)
176 add_issue(version)
177 assert_equal 0, version.estimated_hours
177 assert_equal 0, version.estimated_hours
178 end
178 end
179
179
180 test "#estimated_hours should return return the sum of estimated hours" do
180 test "#estimated_hours should return return the sum of estimated hours" do
181 version = Version.generate!
181 version = Version.create!(:project_id => 1, :name => 'test')
182 add_issue(version, :estimated_hours => 2.5)
182 add_issue(version, :estimated_hours => 2.5)
183 add_issue(version, :estimated_hours => 5)
183 add_issue(version, :estimated_hours => 5)
184 assert_equal 7.5, version.estimated_hours
184 assert_equal 7.5, version.estimated_hours
185 end
185 end
186
186
187 test "#estimated_hours should return the sum of leaves estimated hours" do
187 test "#estimated_hours should return the sum of leaves estimated hours" do
188 version = Version.generate!
188 version = Version.create!(:project_id => 1, :name => 'test')
189 parent = add_issue(version)
189 parent = add_issue(version)
190 add_issue(version, :estimated_hours => 2.5, :parent_issue_id => parent.id)
190 add_issue(version, :estimated_hours => 2.5, :parent_issue_id => parent.id)
191 add_issue(version, :estimated_hours => 5, :parent_issue_id => parent.id)
191 add_issue(version, :estimated_hours => 5, :parent_issue_id => parent.id)
General Comments 0
You need to be logged in to leave comments. Login now