summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-25 18:01:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-25 18:01:27 +0000
commitbd42b7cd9e69e85b3b983e6f51092b9374913520 (patch)
tree0be0dfb086930c4056f1b094b2f15a01c137e907 /test/unit/project_test.rb
parent70340910de1d5eea1e3dc97314fb5b7a23cb9d87 (diff)
downloadredmine-bd42b7cd9e69e85b3b983e6f51092b9374913520.tar.gz
redmine-bd42b7cd9e69e85b3b983e6f51092b9374913520.zip
Validate project identifier only when changed (#3352).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2762 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 1ea5c1982..2c8745856 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -48,6 +48,20 @@ class ProjectTest < Test::Unit::TestCase
assert_equal I18n.translate('activerecord.errors.messages.blank'), @ecookbook.errors.on(:name)
end
+ def test_validate_identifier
+ to_test = {"abc" => true,
+ "ab12" => true,
+ "ab-12" => true,
+ "12" => false}
+
+ to_test.each do |identifier, valid|
+ p = Project.new
+ p.identifier = identifier
+ p.valid?
+ assert_equal valid, p.errors.on('identifier').nil?
+ end
+ end
+
def test_archive
user = @ecookbook.members.first.user
@ecookbook.archive