@@ -91,7 +91,7 class Version < ActiveRecord::Base | |||
|
91 | 91 | |
|
92 | 92 | # Returns true if the version is completed: due date reached and no open issues |
|
93 | 93 | def completed? |
|
94 |
effective_date && (effective_date < |
|
|
94 | effective_date && (effective_date < Date.today) && (open_issues_count == 0) | |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | 97 | def behind_schedule? |
@@ -119,6 +119,11 class VersionTest < ActiveSupport::TestCase | |||
|
119 | 119 | assert_equal [v5, v3, v1, v2, v4], Version.sorted.all |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | def test_completed_should_be_false_when_due_today | |
|
123 | version = Version.create!(:project_id => 1, :effective_date => Date.today, :name => 'Due today') | |
|
124 | assert_equal false, version.completed? | |
|
125 | end | |
|
126 | ||
|
122 | 127 | context "#behind_schedule?" do |
|
123 | 128 | setup do |
|
124 | 129 | ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests |
General Comments 0
You need to be logged in to leave comments.
Login now