Commit 8e354c9c authored by jplang's avatar jplang

Tests for #22754.

git-svn-id: https://svn.redmine.org/redmine/trunk@15443 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 9c784ed8
......@@ -40,6 +40,26 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base
assert_equal "52", group.custom_field_value(field)
end
def test_boolean_custom_fields_should_accept_strings
field = GroupCustomField.generate!(:field_format => 'bool')
post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": "1"}}}),
{'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "1", group.custom_field_value(field)
end
def test_boolean_custom_fields_should_accept_integers
field = GroupCustomField.generate!(:field_format => 'bool')
post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": 1}}}),
{'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "1", group.custom_field_value(field)
end
def test_multivalued_custom_fields_should_accept_an_array
field = GroupCustomField.generate!(
:field_format => 'list',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment