]> source.dussan.org Git - redmine.git/commitdiff
Merged r14084, r14086 and r14087 from trunk to 3.0-stable (#19368)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 14 Mar 2015 16:50:00 +0000 (16:50 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sat, 14 Mar 2015 16:50:00 +0000 (16:50 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14100 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/api_test/custom_fields_attribute_test.rb
test/integration/api_test/issues_test.rb

index a82fcfde0ebba7a0afc8e9e6008a65cf757bd4e5..15c2acffffd6d7c60a13cff92194de21b08d4ff1 100644 (file)
@@ -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).sort
+  end
 end
index 1825beb2cd8818ea7b98d2b9c7a85cec3de4638c..8213834bafed93ffd3f9c01278544bd2c9a81843 100644 (file)
@@ -432,7 +432,7 @@ JSON
 
     assert_response :created
     issue = Issue.order('id DESC').first
-    assert_equal ["V1", "V3"], issue.custom_field_value(field)
+    assert_equal ["V1", "V3"], issue.custom_field_value(field).sort
   end
 
   test "POST /issues.json with failure should return errors" do