summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-18 16:43:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-18 16:43:14 +0000
commit1737552eca732d53273f0dfbf32bde0bc4ff6657 (patch)
treeecaf9d7800c66fb8d06385c88bb6c0ee6be4750d /test/unit/issue_test.rb
parent9ff16dd41119020f5a63209a7ade9f7a0c341226 (diff)
downloadredmine-1737552eca732d53273f0dfbf32bde0bc4ff6657.tar.gz
redmine-1737552eca732d53273f0dfbf32bde0bc4ff6657.zip
Fixed that invalid start date is ignored (#12092).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10670 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 39a09396f..ae6f9ee94 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -54,6 +54,24 @@ class IssueTest < ActiveSupport::TestCase
assert_nil issue.estimated_hours
end
+ def test_start_date_format_should_be_validated
+ set_language_if_valid 'en'
+ ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
+ issue = Issue.new(:start_date => invalid_date)
+ assert !issue.valid?
+ assert_include 'Start date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
+ end
+ end
+
+ def test_due_date_format_should_be_validated
+ set_language_if_valid 'en'
+ ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
+ issue = Issue.new(:due_date => invalid_date)
+ assert !issue.valid?
+ assert_include 'Due date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
+ end
+ end
+
def test_create_with_required_custom_field
set_language_if_valid 'en'
field = IssueCustomField.find_by_name('Database')