diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-29 20:51:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-29 20:51:48 +0000 |
commit | cd6db6a3cbe43880eca4eec8c967fb78d95a2926 (patch) | |
tree | 42219d3f9b276f197f5045cec25639bb4e2be5fd /test/unit/custom_field_test.rb | |
parent | 0c5af16e14570a384e154430cd1e9fa123cdf579 (diff) | |
download | redmine-cd6db6a3cbe43880eca4eec8c967fb78d95a2926.tar.gz redmine-cd6db6a3cbe43880eca4eec8c967fb78d95a2926.zip |
Adds support for multiselect custom fields (#1189).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8721 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/custom_field_test.rb')
-rw-r--r-- | test/unit/custom_field_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 2d1183b72..6cef44ea9 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -164,4 +164,26 @@ class CustomFieldTest < ActiveSupport::TestCase assert f.valid_field_value?('5') assert !f.valid_field_value?('6abc') end + + def test_multi_field_validation + f = CustomField.new(:field_format => 'list', :multiple => 'true', :possible_values => ['value1', 'value2']) + + assert f.valid_field_value?(nil) + 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?('value2') + assert !f.valid_field_value?('abc') + + assert f.valid_field_value?(['value2']) + assert !f.valid_field_value?(['abc']) + + assert f.valid_field_value?(['', 'value2']) + assert !f.valid_field_value?(['', 'abc']) + + assert f.valid_field_value?(['value1', 'value2']) + assert !f.valid_field_value?(['value1', 'abc']) + end end |