# Returns true if the version is completed: due date reached and no open issues
def completed?
- effective_date && (effective_date <= Date.today) && (open_issues_count == 0)
+ effective_date && (effective_date < Date.today) && (open_issues_count == 0)
end
def behind_schedule?
assert_equal [v5, v3, v1, v2, v4], Version.sorted.all
end
+ def test_completed_should_be_false_when_due_today
+ version = Version.create!(:project_id => 1, :effective_date => Date.today, :name => 'Due today')
+ assert_equal false, version.completed?
+ end
+
context "#behind_schedule?" do
setup do
ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests