summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-04 07:41:05 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-04 07:41:05 +0000
commit681740d5beb8441d81a4cc3ed328fe019d88b6a3 (patch)
treed0b90f33acf2ec5d3768a99fa4a17b199282733d
parentf20f49a76b9efe4e90659cc1decf973de4149452 (diff)
downloadredmine-681740d5beb8441d81a4cc3ed328fe019d88b6a3.tar.gz
redmine-681740d5beb8441d81a4cc3ed328fe019d88b6a3.zip
Tests for #22754.
git-svn-id: http://svn.redmine.org/redmine/trunk@15443 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/integration/api_test/custom_fields_attribute_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/integration/api_test/custom_fields_attribute_test.rb b/test/integration/api_test/custom_fields_attribute_test.rb
index 7fbfc19e1..401b06506 100644
--- a/test/integration/api_test/custom_fields_attribute_test.rb
+++ b/test/integration/api_test/custom_fields_attribute_test.rb
@@ -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',