summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-01 15:57:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-01 15:57:31 +0000
commit5a3b9037333e4ff6f3727b0fb058b560be38240a (patch)
tree4b4d8a5d22587996025a535895c44e98eac8e681 /test/integration
parent92dcaeb4729fa45dd885c2d19b25e0268ea515a8 (diff)
downloadredmine-5a3b9037333e4ff6f3727b0fb058b560be38240a.tar.gz
redmine-5a3b9037333e4ff6f3727b0fb058b560be38240a.zip
Fixed: Unable to set custom fields for versions using the REST API (#13850).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11760 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/versions_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb
index 8be37534a..51f8e2b33 100644
--- a/test/integration/api_test/versions_test.rb
+++ b/test/integration/api_test/versions_test.rb
@@ -82,6 +82,29 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
assert_tag 'version', :child => {:tag => 'id', :content => version.id.to_s}
end
+ should "create the version with custom fields" do
+ field = VersionCustomField.generate!
+
+ assert_difference 'Version.count' do
+ post '/projects/1/versions.xml', {
+ :version => {
+ :name => 'API test',
+ :custom_fields => [
+ {'id' => field.id.to_s, 'value' => 'Some value'}
+ ]
+ }
+ }, credentials('jsmith')
+ end
+
+ version = Version.first(:order => 'id DESC')
+ assert_equal 'API test', version.name
+ assert_equal 'Some value', version.custom_field_value(field)
+
+ assert_response :created
+ assert_equal 'application/xml', @response.content_type
+ assert_select 'version>custom_fields>custom_field[id=?]>value', field.id.to_s, 'Some value'
+ end
+
context "with failure" do
should "return the errors" do
assert_no_difference('Version.count') do