mirror of
https://github.com/redmine/redmine.git
synced 2025-11-06 21:35:46 +01:00
Tests for #22754.
git-svn-id: http://svn.redmine.org/redmine/trunk@15443 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user