code layout clean up context "#behind_schedule?" of unit issue test

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10634 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-10-13 10:15:08 +00:00
parent be79553f33
commit 0bcc6115c3
1 changed files with 15 additions and 5 deletions

View File

@ -1231,23 +1231,33 @@ class IssueTest < ActiveSupport::TestCase
context "#behind_schedule?" do context "#behind_schedule?" do
should "be false if the issue has no start_date" do should "be false if the issue has no start_date" do
assert !Issue.new(:start_date => nil, :due_date => 1.day.from_now.to_date, :done_ratio => 0).behind_schedule? assert !Issue.new(:start_date => nil,
:due_date => 1.day.from_now.to_date,
:done_ratio => 0).behind_schedule?
end end
should "be false if the issue has no end_date" do should "be false if the issue has no end_date" do
assert !Issue.new(:start_date => 1.day.from_now.to_date, :due_date => nil, :done_ratio => 0).behind_schedule? assert !Issue.new(:start_date => 1.day.from_now.to_date,
:due_date => nil,
:done_ratio => 0).behind_schedule?
end end
should "be false if the issue has more done than it's calendar time" do should "be false if the issue has more done than it's calendar time" do
assert !Issue.new(:start_date => 50.days.ago.to_date, :due_date => 50.days.from_now.to_date, :done_ratio => 90).behind_schedule? assert !Issue.new(:start_date => 50.days.ago.to_date,
:due_date => 50.days.from_now.to_date,
:done_ratio => 90).behind_schedule?
end end
should "be true if the issue hasn't been started at all" do should "be true if the issue hasn't been started at all" do
assert Issue.new(:start_date => 1.day.ago.to_date, :due_date => 1.day.from_now.to_date, :done_ratio => 0).behind_schedule? assert Issue.new(:start_date => 1.day.ago.to_date,
:due_date => 1.day.from_now.to_date,
:done_ratio => 0).behind_schedule?
end end
should "be true if the issue has used more calendar time than it's done ratio" do should "be true if the issue has used more calendar time than it's done ratio" do
assert Issue.new(:start_date => 100.days.ago.to_date, :due_date => Date.today, :done_ratio => 90).behind_schedule? assert Issue.new(:start_date => 100.days.ago.to_date,
:due_date => Date.today,
:done_ratio => 90).behind_schedule?
end end
end end