summaryrefslogtreecommitdiffstats
path: root/test/unit/custom_field_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-28 10:05:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-02-28 10:05:27 +0000
commit4c7a76785d9fb695d1fb9a95e55e301095061084 (patch)
tree160cd3be4f4f8b7f2e9fc88ae1c532cef5c9337d /test/unit/custom_field_test.rb
parent0cf7a27b503d03772e4ab26b6ef993f4092d669a (diff)
downloadredmine-4c7a76785d9fb695d1fb9a95e55e301095061084.tar.gz
redmine-4c7a76785d9fb695d1fb9a95e55e301095061084.zip
Fixed that non-empty blank strings as custom field values are not properly validated (#16169).
git-svn-id: http://svn.redmine.org/redmine/trunk@12938 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/custom_field_test.rb')
-rw-r--r--test/unit/custom_field_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb
index 6a9c28f92..ca94f7134 100644
--- a/test/unit/custom_field_test.rb
+++ b/test/unit/custom_field_test.rb
@@ -146,6 +146,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('a' * 2)
assert !f.valid_field_value?('a')
assert !f.valid_field_value?('a' * 6)
@@ -156,6 +157,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('ABC')
assert !f.valid_field_value?('abc')
end
@@ -165,6 +167,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('1975-07-14')
assert !f.valid_field_value?('1975-07-33')
assert !f.valid_field_value?('abc')
@@ -175,6 +178,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('value2')
assert !f.valid_field_value?('abc')
end
@@ -184,6 +188,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('123')
assert f.valid_field_value?('+123')
assert f.valid_field_value?('-123')
@@ -195,6 +200,7 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?('11.2')
assert f.valid_field_value?('-6.250')
assert f.valid_field_value?('5')
@@ -206,9 +212,11 @@ class CustomFieldTest < ActiveSupport::TestCase
assert f.valid_field_value?(nil)
assert f.valid_field_value?('')
+ assert !f.valid_field_value?(' ')
assert f.valid_field_value?([])
assert f.valid_field_value?([nil])
assert f.valid_field_value?([''])
+ assert !f.valid_field_value?([' '])
assert f.valid_field_value?('value2')
assert !f.valid_field_value?('abc')