]> source.dussan.org Git - redmine.git/commitdiff
Makes projects API return XML description when creating a project (#6874).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Nov 2010 10:05:43 +0000 (10:05 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Nov 2010 10:05:43 +0000 (10:05 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4397 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
test/integration/api_test/issues_test.rb
test/integration/api_test/projects_test.rb

index c3efbfd9f2dce5092ff12545b8e977a6cda827ff..a6a5c9e5f9e27ee3c78c4af6933afe3efc7bc27f 100644 (file)
@@ -93,7 +93,7 @@ class ProjectsController < ApplicationController
           flash[:notice] = l(:notice_successful_create)
           redirect_to :controller => 'projects', :action => 'settings', :id => @project
         }
-        format.xml  { head :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
+        format.xml  { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
       end
     else
       respond_to do |format|
index 60ee66bb908d291663df21525027013f252681e1..1c1f3f8b7e8556a13658634aac260f370b72f43e 100644 (file)
@@ -106,6 +106,10 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
       assert_equal 2, issue.tracker_id
       assert_equal 3, issue.status_id
       assert_equal 'API test', issue.subject
+  
+      assert_response :created
+      assert_equal 'application/xml', @response.content_type
+      assert_tag 'issue', :child => {:tag => 'id', :content => issue.id.to_s}
     end
   end
   
index de84daa08c160f9805bd5df45ab3ac8eb1b3451b..21b080a13375c8605c65a29ca01b8009a68a86c9 100644 (file)
@@ -52,12 +52,15 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
     assert_difference 'Project.count' do
       post '/projects.xml', {:project => attributes}, :authorization => credentials('admin')
     end
-    assert_response :created
-    assert_equal 'application/xml', @response.content_type
+    
     project = Project.first(:order => 'id DESC')
     attributes.each do |attribute, value|
       assert_equal value, project.send(attribute)
     end
+
+    assert_response :created
+    assert_equal 'application/xml', @response.content_type
+    assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s}
   end
   
   def test_create_failure