@@ -93,7 +93,7 class ProjectsController < ApplicationController | |||||
93 | flash[:notice] = l(:notice_successful_create) |
|
93 | flash[:notice] = l(:notice_successful_create) | |
94 | redirect_to :controller => 'projects', :action => 'settings', :id => @project |
|
94 | redirect_to :controller => 'projects', :action => 'settings', :id => @project | |
95 | } |
|
95 | } | |
96 |
format.xml { |
|
96 | format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } | |
97 | end |
|
97 | end | |
98 | else |
|
98 | else | |
99 | respond_to do |format| |
|
99 | respond_to do |format| |
@@ -43,12 +43,15 class ProjectsApiTest < ActionController::IntegrationTest | |||||
43 | assert_difference 'Project.count' do |
|
43 | assert_difference 'Project.count' do | |
44 | post '/projects.xml', {:project => attributes}, :authorization => credentials('admin') |
|
44 | post '/projects.xml', {:project => attributes}, :authorization => credentials('admin') | |
45 | end |
|
45 | end | |
46 | assert_response :created |
|
46 | ||
47 | assert_equal 'application/xml', @response.content_type |
|
|||
48 | project = Project.first(:order => 'id DESC') |
|
47 | project = Project.first(:order => 'id DESC') | |
49 | attributes.each do |attribute, value| |
|
48 | attributes.each do |attribute, value| | |
50 | assert_equal value, project.send(attribute) |
|
49 | assert_equal value, project.send(attribute) | |
51 | end |
|
50 | end | |
|
51 | ||||
|
52 | assert_response :created | |||
|
53 | assert_equal 'application/xml', @response.content_type | |||
|
54 | assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s} | |||
52 | end |
|
55 | end | |
53 |
|
56 | |||
54 | def test_create_failure |
|
57 | def test_create_failure |
General Comments 0
You need to be logged in to leave comments.
Login now