diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 08:25:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 08:25:20 +0000 |
commit | 1aea5ccfd4e818a93f6340b01fd659409f8ec598 (patch) | |
tree | 433efdb93600c26bf0d293c323c2bc60967a9f72 /test | |
parent | 38daed8b4e571561451fabc6982d1c2c323aff3e (diff) | |
download | redmine-1aea5ccfd4e818a93f6340b01fd659409f8ec598.tar.gz redmine-1aea5ccfd4e818a93f6340b01fd659409f8ec598.zip |
CustomField#possible_values may raise undefined method `force_encoding' error (#19316).
git-svn-id: http://svn.redmine.org/redmine/trunk@14079 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/custom_field_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 815939d33..f40875137 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -85,12 +85,26 @@ class CustomFieldTest < ActiveSupport::TestCase assert_equal ["One value"], field.possible_values end + def test_possible_values_should_stringify_values + field = CustomField.new + field.possible_values = [1, 2] + assert_equal ["1", "2"], field.possible_values + end + def test_possible_values_should_accept_a_string field = CustomField.new field.possible_values = "One value" assert_equal ["One value"], field.possible_values end + def test_possible_values_should_return_utf8_encoded_strings + field = CustomField.new + s = "Value".force_encoding('BINARY') + field.possible_values = s + assert_equal [s], field.possible_values + assert_equal 'UTF-8', field.possible_values.first.encoding.name + end + def test_possible_values_should_accept_a_multiline_string field = CustomField.new field.possible_values = "One value\nAnd another one \r\n \n" |