summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test/custom_fields_attribute_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/api_test/custom_fields_attribute_test.rb')
-rw-r--r--test/integration/api_test/custom_fields_attribute_test.rb34
1 files changed, 25 insertions, 9 deletions
diff --git a/test/integration/api_test/custom_fields_attribute_test.rb b/test/integration/api_test/custom_fields_attribute_test.rb
index 401b06506..66e00f36e 100644
--- a/test/integration/api_test/custom_fields_attribute_test.rb
+++ b/test/integration/api_test/custom_fields_attribute_test.rb
@@ -23,8 +23,11 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base
def test_integer_custom_fields_should_accept_strings
field = GroupCustomField.generate!(:field_format => 'int')
- post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}":"52"}}}),
- {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin'))
+ post '/groups.json',
+ :params => %({"group":{"name":"Foo","custom_field_values":{"#{field.id}":"52"}}}),
+ :headers => {
+ 'CONTENT_TYPE' => 'application/json'
+ }.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "52", group.custom_field_value(field)
@@ -33,8 +36,11 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base
def test_integer_custom_fields_should_accept_integers
field = GroupCustomField.generate!(:field_format => 'int')
- post '/groups.json', %({"group":{"name":"Foo","custom_field_values":{"#{field.id}":52}}}),
- {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin'))
+ post '/groups.json',
+ :params => %({"group":{"name":"Foo","custom_field_values":{"#{field.id}":52}}}),
+ :headers => {
+ 'CONTENT_TYPE' => 'application/json'
+ }.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "52", group.custom_field_value(field)
@@ -43,8 +49,11 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base
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'))
+ post '/groups.json',
+ :params => %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": "1"}}}),
+ :headers => {
+ 'CONTENT_TYPE' => 'application/json'
+ }.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "1", group.custom_field_value(field)
@@ -53,8 +62,11 @@ class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base
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'))
+ post '/groups.json',
+ :params => %({"group":{"name":"Foo","custom_field_values":{"#{field.id}": 1}}}),
+ :headers => {
+ 'CONTENT_TYPE' => 'application/json'
+ }.merge(credentials('admin'))
assert_response :created
group = Group.order('id DESC').first
assert_equal "1", group.custom_field_value(field)
@@ -75,7 +87,11 @@ payload = <<-JSON
}
JSON
- post '/groups.json', payload, {'CONTENT_TYPE' => 'application/json'}.merge(credentials('admin'))
+ post '/groups.json',
+ :params => payload,
+ :headers => {
+ '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