diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-20 16:29:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-20 16:29:34 +0000 |
commit | 4f92276654fe7560e44cb8ae82df7f87fdd60eb1 (patch) | |
tree | 6ab2bb0960194e8d755dbb21376db031080c700c /test/unit/custom_field_test.rb | |
parent | 0a05da4f332ae1f2514c2f795336881c69793e2b (diff) | |
download | redmine-4f92276654fe7560e44cb8ae82df7f87fdd60eb1.tar.gz redmine-4f92276654fe7560e44cb8ae82df7f87fdd60eb1.zip |
Validate custom field regexp (#8865).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6298 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/custom_field_test.rb')
-rw-r--r-- | test/unit/custom_field_test.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 4d80f5f3a..d19e89095 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006-2007 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -25,6 +25,15 @@ class CustomFieldTest < ActiveSupport::TestCase assert field.save end + def test_regexp_validation + field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9') + assert !field.save + assert_equal I18n.t('activerecord.errors.messages.invalid'), field.errors.on(:regexp) + + field.regexp = '[a-z0-9]' + assert field.save + end + def test_possible_values_should_accept_an_array field = CustomField.new field.possible_values = ["One value", ""] |