@@ -39,4 +39,25 class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base | |||
|
39 | 39 | group = Group.order('id DESC').first |
|
40 | 40 | assert_equal "52", group.custom_field_value(field) |
|
41 | 41 | end |
|
42 | ||
|
43 | def test_multivalued_custom_fields_should_accept_an_array | |
|
44 | field = GroupCustomField.generate!( | |
|
45 | :field_format => 'list', | |
|
46 | :multiple => true, | |
|
47 | :possible_values => ["V1", "V2", "V3"], | |
|
48 | :default_value => "V2" | |
|
49 | ) | |
|
50 | ||
|
51 | payload = <<-JSON | |
|
52 | {"group": {"name":"Foooo", | |
|
53 | "custom_field_values":{"#{field.id}":["V1","V3"]} | |
|
54 | } | |
|
55 | } | |
|
56 | JSON | |
|
57 | ||
|
58 | post '/groups.json', payload, {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin')) | |
|
59 | assert_response :created | |
|
60 | group = Group.order('id DESC').first | |
|
61 | assert_equal ["V1", "V3"], group.custom_field_value(field) | |
|
62 | end | |
|
42 | 63 | end |
General Comments 0
You need to be logged in to leave comments.
Login now