summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-10 10:48:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-10 10:48:16 +0000
commit3e3315c103f232655ac8553fcd476792f7d24691 (patch)
treeeb8eb970f48425895296f1ed74107d022422ddeb /test
parent0e19aa4362a0524d900044fc9dc69e177337eca0 (diff)
downloadredmine-3e3315c103f232655ac8553fcd476792f7d24691.tar.gz
redmine-3e3315c103f232655ac8553fcd476792f7d24691.zip
Support for updating custom fields using the received custom_fields array (#6345, #6403).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4481 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/issues.yml2
-rw-r--r--test/integration/api_test/issues_test.rb17
2 files changed, 18 insertions, 1 deletions
diff --git a/test/fixtures/issues.yml b/test/fixtures/issues.yml
index eec014ff4..15fb5b271 100644
--- a/test/fixtures/issues.yml
+++ b/test/fixtures/issues.yml
@@ -54,7 +54,7 @@ issues_003:
author_id: 2
status_id: 1
start_date: <%= 1.day.from_now.to_date.to_s(:db) %>
- due_date: <%= 40.day.ago.to_date.to_s(:db) %>
+ due_date: <%= 40.day.from_now.to_date.to_s(:db) %>
root_id: 3
lft: 1
rgt: 2
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index c57b51eea..a5281e5eb 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -284,6 +284,23 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
end
+ context "PUT /issues/3.xml with custom fields" do
+ setup do
+ @parameters = {:issue => {:custom_fields => [{'id' => '1', 'value' => 'PostgreSQL' }, {'id' => '2', 'value' => '150'}]}}
+ @headers = { :authorization => credentials('jsmith') }
+ end
+
+ should "update custom fields" do
+ assert_no_difference('Issue.count') do
+ put '/issues/3.xml', @parameters, @headers
+ end
+
+ issue = Issue.find(3)
+ assert_equal '150', issue.custom_value_for(2).value
+ assert_equal 'PostgreSQL', issue.custom_value_for(1).value
+ end
+ end
+
context "PUT /issues/6.xml with failed update" do
setup do
@parameters = {:issue => {:subject => ''}}