@@ -40,6 +40,26 class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base | |||||
40 | assert_equal "52", group.custom_field_value(field) |
|
40 | assert_equal "52", group.custom_field_value(field) | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
|
43 | def test_boolean_custom_fields_should_accept_strings | |||
|
44 | field = GroupCustomField.generate!(:field_format => 'bool') | |||
|
45 | ||||
|
46 | post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": "1"}}}), | |||
|
47 | {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin')) | |||
|
48 | assert_response :created | |||
|
49 | group = Group.order('id DESC').first | |||
|
50 | assert_equal "1", group.custom_field_value(field) | |||
|
51 | end | |||
|
52 | ||||
|
53 | def test_boolean_custom_fields_should_accept_integers | |||
|
54 | field = GroupCustomField.generate!(:field_format => 'bool') | |||
|
55 | ||||
|
56 | post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": 1}}}), | |||
|
57 | {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin')) | |||
|
58 | assert_response :created | |||
|
59 | group = Group.order('id DESC').first | |||
|
60 | assert_equal "1", group.custom_field_value(field) | |||
|
61 | end | |||
|
62 | ||||
43 | def test_multivalued_custom_fields_should_accept_an_array |
|
63 | def test_multivalued_custom_fields_should_accept_an_array | |
44 | field = GroupCustomField.generate!( |
|
64 | field = GroupCustomField.generate!( | |
45 | :field_format => 'list', |
|
65 | :field_format => 'list', |
General Comments 0
You need to be logged in to leave comments.
Login now