summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-05 19:56:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-05 19:56:59 +0000
commit8cea7d8cf213174d282db85ef5e16832c9845501 (patch)
tree25729db612b245df31ea14a6abc2f6ada419327c /test/unit/issue_test.rb
parent6327bdc6f871e9fa931a61615ec62c086d93dbbe (diff)
downloadredmine-8cea7d8cf213174d282db85ef5e16832c9845501.tar.gz
redmine-8cea7d8cf213174d282db85ef5e16832c9845501.zip
Don't validate start date when updating an issue without changing it (#14086).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11931 e93f8b46-1217-0410-a6f0-8f06a7374b81
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|