diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 09:54:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-03-14 09:54:11 +0000 |
commit | 9dfe8fe03cde6f237f4f96cf79c16b20b42d7d69 (patch) | |
tree | 66c8aa714d9335aea3a95d77f20141029e6127cb /test | |
parent | 5e1d042c40ac8d2b19ab7c7c951623386d93191b (diff) | |
download | redmine-9dfe8fe03cde6f237f4f96cf79c16b20b42d7d69.tar.gz redmine-9dfe8fe03cde6f237f4f96cf79c16b20b42d7d69.zip |
Adds a test for setting multivalued custom fields with JSON (#19368).
git-svn-id: http://svn.redmine.org/redmine/trunk@14084 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/api_test/custom_fields_attribute_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/integration/api_test/custom_fields_attribute_test.rb b/test/integration/api_test/custom_fields_attribute_test.rb index a82fcfde0..55385b807 100644 --- a/test/integration/api_test/custom_fields_attribute_test.rb +++ b/test/integration/api_test/custom_fields_attribute_test.rb @@ -39,4 +39,25 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base group = Group.order('id DESC').first assert_equal "52", group.custom_field_value(field) end + + def test_multivalued_custom_fields_should_accept_an_array + field = GroupCustomField.generate!( + :field_format => 'list', + :multiple => true, + :possible_values => ["V1", "V2", "V3"], + :default_value => "V2" + ) + +payload = <<-JSON +{"group": {"name":"Foooo", +"custom_field_values":{"#{field.id}":["V1","V3"]} +} +} +JSON + + post '/groups.json', payload, {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin')) + assert_response :created + group = Group.order('id DESC').first + assert_equal ["V1", "V3"], group.custom_field_value(field) + end end |