summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 0fa880809..c7d134074 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -92,6 +92,27 @@ class IssueTest < ActiveSupport::TestCase
assert_include 'Due date must be greater than start date', issue.errors.full_messages
end
+ def test_start_date_lesser_than_soonest_start_should_not_validate_on_create
+ issue = Issue.generate(:start_date => '2013-06-04')
+ issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
+ assert !issue.valid?
+ assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
+ end
+
+ def test_start_date_lesser_than_soonest_start_should_not_validate_on_update_if_changed
+ issue = Issue.generate!(:start_date => '2013-06-04')
+ issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
+ issue.start_date = '2013-06-07'
+ assert !issue.valid?
+ assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
+ end
+
+ def test_start_date_lesser_than_soonest_start_should_validate_on_update_if_unchanged
+ issue = Issue.generate!(:start_date => '2013-06-04')
+ issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
+ assert issue.valid?
+ end
+
def test_estimated_hours_should_be_validated
set_language_if_valid 'en'
['-2'].each do |invalid|