summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test/projects_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 16:32:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 16:32:48 +0000
commit054b7d28f1994a61c04d837a066fa0164d439858 (patch)
tree4bc2b0c2553c73b91eecdbe7de47ca70be843b6a /test/integration/api_test/projects_test.rb
parent8458faed11117bd93a0c53eea8cdfb687952bb09 (diff)
downloadredmine-054b7d28f1994a61c04d837a066fa0164d439858.tar.gz
redmine-054b7d28f1994a61c04d837a066fa0164d439858.zip
Accept key auth for ProjectsController#update (#6841).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4442 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test/projects_test.rb')
-rw-r--r--test/integration/api_test/projects_test.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index d898b42ac..c2ffa6920 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -78,16 +78,20 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
assert_tag :errors, :child => {:tag => 'error', :content => "Identifier can't be blank"}
end
- def test_update
- attributes = {:name => 'API update'}
- assert_no_difference 'Project.count' do
- put '/projects/1.xml', {:project => attributes}, :authorization => credentials('jsmith')
- end
- assert_response :ok
- assert_equal 'application/xml', @response.content_type
- project = Project.find(1)
- attributes.each do |attribute, value|
- assert_equal value, project.send(attribute)
+ context "PUT /projects/2.xml" do
+ should_allow_api_authentication(:put,
+ '/projects/2.xml',
+ {:project => {:name => 'API test'}},
+ {:success_code => :ok})
+
+ should "update the project" do
+ assert_no_difference 'Project.count' do
+ put '/projects/2.xml', {:project => {:name => 'API update'}}, :authorization => credentials('jsmith')
+ end
+ assert_response :ok
+ assert_equal 'application/xml', @response.content_type
+ project = Project.find(2)
+ assert_equal 'API update', project.name
end
end