Merged r14084, r14086 and r14087 from trunk to 3.0-stable (#19368)

git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14100 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2015-03-14 16:50:00 +00:00
parent 269b5045ca
commit c271be6d81
2 changed files with 22 additions and 1 deletions

View 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

View 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