@@ -520,6 +520,12 class ApplicationController < ActionController::Base | |||||
520 | render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator." |
|
520 | render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator." | |
521 | end |
|
521 | end | |
522 |
|
522 | |||
|
523 | # Renders a 200 response for successfull updates or deletions via the API | |||
|
524 | def render_api_ok | |||
|
525 | # head :ok would return a response body with one space | |||
|
526 | render :text => '', :status => :ok, :layout => nil | |||
|
527 | end | |||
|
528 | ||||
523 | # Renders API response on validation failure |
|
529 | # Renders API response on validation failure | |
524 | def render_validation_errors(objects) |
|
530 | def render_validation_errors(objects) | |
525 | if objects.is_a?(Array) |
|
531 | if objects.is_a?(Array) |
@@ -72,7 +72,7 class GroupsController < ApplicationController | |||||
72 | if @group.save |
|
72 | if @group.save | |
73 | flash[:notice] = l(:notice_successful_update) |
|
73 | flash[:notice] = l(:notice_successful_update) | |
74 | format.html { redirect_to(groups_path) } |
|
74 | format.html { redirect_to(groups_path) } | |
75 |
format.api { |
|
75 | format.api { render_api_ok } | |
76 | else |
|
76 | else | |
77 | format.html { render :action => "edit" } |
|
77 | format.html { render :action => "edit" } | |
78 | format.api { render_validation_errors(@group) } |
|
78 | format.api { render_validation_errors(@group) } | |
@@ -85,7 +85,7 class GroupsController < ApplicationController | |||||
85 |
|
85 | |||
86 | respond_to do |format| |
|
86 | respond_to do |format| | |
87 | format.html { redirect_to(groups_url) } |
|
87 | format.html { redirect_to(groups_url) } | |
88 |
format.api { |
|
88 | format.api { render_api_ok } | |
89 | end |
|
89 | end | |
90 | end |
|
90 | end | |
91 |
|
91 | |||
@@ -100,7 +100,7 class GroupsController < ApplicationController | |||||
100 | users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") } |
|
100 | users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") } | |
101 | } |
|
101 | } | |
102 | } |
|
102 | } | |
103 |
format.api { |
|
103 | format.api { render_api_ok } | |
104 | end |
|
104 | end | |
105 | end |
|
105 | end | |
106 |
|
106 | |||
@@ -109,7 +109,7 class GroupsController < ApplicationController | |||||
109 | respond_to do |format| |
|
109 | respond_to do |format| | |
110 | format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' } |
|
110 | format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' } | |
111 | format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} } |
|
111 | format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} } | |
112 |
format.api { |
|
112 | format.api { render_api_ok } | |
113 | end |
|
113 | end | |
114 | end |
|
114 | end | |
115 |
|
115 |
@@ -98,7 +98,7 class IssueCategoriesController < ApplicationController | |||||
98 | flash[:notice] = l(:notice_successful_update) |
|
98 | flash[:notice] = l(:notice_successful_update) | |
99 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project |
|
99 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project | |
100 | } |
|
100 | } | |
101 |
format.api { |
|
101 | format.api { render_api_ok } | |
102 | end |
|
102 | end | |
103 | else |
|
103 | else | |
104 | respond_to do |format| |
|
104 | respond_to do |format| | |
@@ -118,7 +118,7 class IssueCategoriesController < ApplicationController | |||||
118 | @category.destroy(reassign_to) |
|
118 | @category.destroy(reassign_to) | |
119 | respond_to do |format| |
|
119 | respond_to do |format| | |
120 | format.html { redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' } |
|
120 | format.html { redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' } | |
121 |
format.api { |
|
121 | format.api { render_api_ok } | |
122 | end |
|
122 | end | |
123 | return |
|
123 | return | |
124 | end |
|
124 | end |
@@ -76,7 +76,7 class IssueRelationsController < ApplicationController | |||||
76 | respond_to do |format| |
|
76 | respond_to do |format| | |
77 | format.html { redirect_to issue_path } # TODO : does this really work since @issue is always nil? What is it useful to? |
|
77 | format.html { redirect_to issue_path } # TODO : does this really work since @issue is always nil? What is it useful to? | |
78 | format.js { render(:update) {|page| page.remove "relation-#{@relation.id}"} } |
|
78 | format.js { render(:update) {|page| page.remove "relation-#{@relation.id}"} } | |
79 |
format.api { |
|
79 | format.api { render_api_ok } | |
80 | end |
|
80 | end | |
81 | end |
|
81 | end | |
82 |
|
82 |
@@ -197,7 +197,7 class IssuesController < ApplicationController | |||||
197 |
|
197 | |||
198 | respond_to do |format| |
|
198 | respond_to do |format| | |
199 | format.html { redirect_back_or_default({:action => 'show', :id => @issue}) } |
|
199 | format.html { redirect_back_or_default({:action => 'show', :id => @issue}) } | |
200 |
format.api { |
|
200 | format.api { render_api_ok } | |
201 | end |
|
201 | end | |
202 | else |
|
202 | else | |
203 | respond_to do |format| |
|
203 | respond_to do |format| | |
@@ -307,7 +307,7 class IssuesController < ApplicationController | |||||
307 | end |
|
307 | end | |
308 | respond_to do |format| |
|
308 | respond_to do |format| | |
309 | format.html { redirect_back_or_default(:action => 'index', :project_id => @project) } |
|
309 | format.html { redirect_back_or_default(:action => 'index', :project_id => @project) } | |
310 |
format.api { |
|
310 | format.api { render_api_ok } | |
311 | end |
|
311 | end | |
312 | end |
|
312 | end | |
313 |
|
313 |
@@ -107,7 +107,7 class MembersController < ApplicationController | |||||
107 | } |
|
107 | } | |
108 | format.api { |
|
108 | format.api { | |
109 | if saved |
|
109 | if saved | |
110 |
|
|
110 | render_api_ok | |
111 | else |
|
111 | else | |
112 | render_validation_errors(@member) |
|
112 | render_validation_errors(@member) | |
113 | end |
|
113 | end | |
@@ -128,7 +128,7 class MembersController < ApplicationController | |||||
128 | } |
|
128 | } | |
129 | format.api { |
|
129 | format.api { | |
130 | if @member.destroyed? |
|
130 | if @member.destroyed? | |
131 |
|
|
131 | render_api_ok | |
132 | else |
|
132 | else | |
133 | head :unprocessable_entity |
|
133 | head :unprocessable_entity | |
134 | end |
|
134 | end |
@@ -191,7 +191,7 class ProjectsController < ApplicationController | |||||
191 | flash[:notice] = l(:notice_successful_update) |
|
191 | flash[:notice] = l(:notice_successful_update) | |
192 | redirect_to :action => 'settings', :id => @project |
|
192 | redirect_to :action => 'settings', :id => @project | |
193 | } |
|
193 | } | |
194 |
format.api { |
|
194 | format.api { render_api_ok } | |
195 | end |
|
195 | end | |
196 | else |
|
196 | else | |
197 | respond_to do |format| |
|
197 | respond_to do |format| | |
@@ -241,7 +241,7 class ProjectsController < ApplicationController | |||||
241 | @project_to_destroy.destroy |
|
241 | @project_to_destroy.destroy | |
242 | respond_to do |format| |
|
242 | respond_to do |format| | |
243 | format.html { redirect_to :controller => 'admin', :action => 'projects' } |
|
243 | format.html { redirect_to :controller => 'admin', :action => 'projects' } | |
244 |
format.api { |
|
244 | format.api { render_api_ok } | |
245 | end |
|
245 | end | |
246 | end |
|
246 | end | |
247 | # hide project in layout |
|
247 | # hide project in layout |
@@ -171,7 +171,7 class TimelogController < ApplicationController | |||||
171 | flash[:notice] = l(:notice_successful_update) |
|
171 | flash[:notice] = l(:notice_successful_update) | |
172 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project |
|
172 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
173 | } |
|
173 | } | |
174 |
format.api { |
|
174 | format.api { render_api_ok } | |
175 | end |
|
175 | end | |
176 | else |
|
176 | else | |
177 | respond_to do |format| |
|
177 | respond_to do |format| | |
@@ -223,7 +223,7 class TimelogController < ApplicationController | |||||
223 | } |
|
223 | } | |
224 | format.api { |
|
224 | format.api { | |
225 | if destroyed |
|
225 | if destroyed | |
226 |
|
|
226 | render_api_ok | |
227 | else |
|
227 | else | |
228 | render_validation_errors(@time_entries) |
|
228 | render_validation_errors(@time_entries) | |
229 | end |
|
229 | end |
@@ -156,7 +156,7 class UsersController < ApplicationController | |||||
156 | flash[:notice] = l(:notice_successful_update) |
|
156 | flash[:notice] = l(:notice_successful_update) | |
157 | redirect_to_referer_or edit_user_path(@user) |
|
157 | redirect_to_referer_or edit_user_path(@user) | |
158 | } |
|
158 | } | |
159 |
format.api { |
|
159 | format.api { render_api_ok } | |
160 | end |
|
160 | end | |
161 | else |
|
161 | else | |
162 | @auth_sources = AuthSource.find(:all) |
|
162 | @auth_sources = AuthSource.find(:all) | |
@@ -175,7 +175,7 class UsersController < ApplicationController | |||||
175 | @user.destroy |
|
175 | @user.destroy | |
176 | respond_to do |format| |
|
176 | respond_to do |format| | |
177 | format.html { redirect_to_referer_or(users_url) } |
|
177 | format.html { redirect_to_referer_or(users_url) } | |
178 |
format.api { |
|
178 | format.api { render_api_ok } | |
179 | end |
|
179 | end | |
180 | end |
|
180 | end | |
181 |
|
181 |
@@ -144,7 +144,7 class VersionsController < ApplicationController | |||||
144 | flash[:notice] = l(:notice_successful_update) |
|
144 | flash[:notice] = l(:notice_successful_update) | |
145 | redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
145 | redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
146 | } |
|
146 | } | |
147 |
format.api { |
|
147 | format.api { render_api_ok } | |
148 | end |
|
148 | end | |
149 | else |
|
149 | else | |
150 | respond_to do |format| |
|
150 | respond_to do |format| | |
@@ -167,7 +167,7 class VersionsController < ApplicationController | |||||
167 | @version.destroy |
|
167 | @version.destroy | |
168 | respond_to do |format| |
|
168 | respond_to do |format| | |
169 | format.html { redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project } |
|
169 | format.html { redirect_back_or_default :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project } | |
170 |
format.api { |
|
170 | format.api { render_api_ok } | |
171 | end |
|
171 | end | |
172 | else |
|
172 | else | |
173 | respond_to do |format| |
|
173 | respond_to do |format| |
@@ -148,6 +148,7 class ApiTest::GroupsTest < ActionController::IntegrationTest | |||||
148 | should "update the group" do |
|
148 | should "update the group" do | |
149 | put '/groups/10.xml', {:group => {:name => 'New name', :user_ids => [2, 3]}}, credentials('admin') |
|
149 | put '/groups/10.xml', {:group => {:name => 'New name', :user_ids => [2, 3]}}, credentials('admin') | |
150 | assert_response :ok |
|
150 | assert_response :ok | |
|
151 | assert_equal '', @response.body | |||
151 |
|
152 | |||
152 | group = Group.find(10) |
|
153 | group = Group.find(10) | |
153 | assert_equal 'New name', group.name |
|
154 | assert_equal 'New name', group.name | |
@@ -177,6 +178,7 class ApiTest::GroupsTest < ActionController::IntegrationTest | |||||
177 | assert_difference 'Group.count', -1 do |
|
178 | assert_difference 'Group.count', -1 do | |
178 | delete '/groups/10.xml', {}, credentials('admin') |
|
179 | delete '/groups/10.xml', {}, credentials('admin') | |
179 | assert_response :ok |
|
180 | assert_response :ok | |
|
181 | assert_equal '', @response.body | |||
180 | end |
|
182 | end | |
181 | end |
|
183 | end | |
182 | end |
|
184 | end | |
@@ -188,6 +190,7 class ApiTest::GroupsTest < ActionController::IntegrationTest | |||||
188 | assert_difference 'Group.find(10).users.count' do |
|
190 | assert_difference 'Group.find(10).users.count' do | |
189 | post '/groups/10/users.xml', {:user_id => 5}, credentials('admin') |
|
191 | post '/groups/10/users.xml', {:user_id => 5}, credentials('admin') | |
190 | assert_response :ok |
|
192 | assert_response :ok | |
|
193 | assert_equal '', @response.body | |||
191 | end |
|
194 | end | |
192 | assert_include User.find(5), Group.find(10).users |
|
195 | assert_include User.find(5), Group.find(10).users | |
193 | end |
|
196 | end | |
@@ -200,6 +203,7 class ApiTest::GroupsTest < ActionController::IntegrationTest | |||||
200 | assert_difference 'Group.find(10).users.count', -1 do |
|
203 | assert_difference 'Group.find(10).users.count', -1 do | |
201 | delete '/groups/10/users/8.xml', {}, credentials('admin') |
|
204 | delete '/groups/10/users/8.xml', {}, credentials('admin') | |
202 | assert_response :ok |
|
205 | assert_response :ok | |
|
206 | assert_equal '', @response.body | |||
203 | end |
|
207 | end | |
204 | assert_not_include User.find(8), Group.find(10).users |
|
208 | assert_not_include User.find(8), Group.find(10).users | |
205 | end |
|
209 | end |
@@ -81,6 +81,7 class ApiTest::IssueCategoriesTest < ActionController::IntegrationTest | |||||
81 | put '/issue_categories/2.xml', {:issue_category => {:name => 'API Update'}}, credentials('jsmith') |
|
81 | put '/issue_categories/2.xml', {:issue_category => {:name => 'API Update'}}, credentials('jsmith') | |
82 | end |
|
82 | end | |
83 | assert_response :ok |
|
83 | assert_response :ok | |
|
84 | assert_equal '', @response.body | |||
84 | assert_equal 'API Update', IssueCategory.find(2).name |
|
85 | assert_equal 'API Update', IssueCategory.find(2).name | |
85 | end |
|
86 | end | |
86 | end |
|
87 | end | |
@@ -104,6 +105,7 class ApiTest::IssueCategoriesTest < ActionController::IntegrationTest | |||||
104 | delete '/issue_categories/1.xml', {}, credentials('jsmith') |
|
105 | delete '/issue_categories/1.xml', {}, credentials('jsmith') | |
105 | end |
|
106 | end | |
106 | assert_response :ok |
|
107 | assert_response :ok | |
|
108 | assert_equal '', @response.body | |||
107 | assert_nil IssueCategory.find_by_id(1) |
|
109 | assert_nil IssueCategory.find_by_id(1) | |
108 | end |
|
110 | end | |
109 |
|
111 | |||
@@ -117,6 +119,7 class ApiTest::IssueCategoriesTest < ActionController::IntegrationTest | |||||
117 | end |
|
119 | end | |
118 | end |
|
120 | end | |
119 | assert_response :ok |
|
121 | assert_response :ok | |
|
122 | assert_equal '', @response.body | |||
120 | assert_nil IssueCategory.find_by_id(1) |
|
123 | assert_nil IssueCategory.find_by_id(1) | |
121 | end |
|
124 | end | |
122 | end |
|
125 | end |
@@ -99,6 +99,7 class ApiTest::IssueRelationsTest < ActionController::IntegrationTest | |||||
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | assert_response :ok |
|
101 | assert_response :ok | |
|
102 | assert_equal '', @response.body | |||
102 | assert_nil IssueRelation.find_by_id(2) |
|
103 | assert_nil IssueRelation.find_by_id(2) | |
103 | end |
|
104 | end | |
104 | end |
|
105 | end |
@@ -770,6 +770,7 class ApiTest::IssuesTest < ActionController::IntegrationTest | |||||
770 | {:issue => {:notes => 'Attachment added', :uploads => [{:token => token, :filename => 'test.txt', :content_type => 'text/plain'}]}}, |
|
770 | {:issue => {:notes => 'Attachment added', :uploads => [{:token => token, :filename => 'test.txt', :content_type => 'text/plain'}]}}, | |
771 | credentials('jsmith') |
|
771 | credentials('jsmith') | |
772 | assert_response :ok |
|
772 | assert_response :ok | |
|
773 | assert_equal '', @response.body | |||
773 | end |
|
774 | end | |
774 |
|
775 | |||
775 | issue = Issue.find(1) |
|
776 | issue = Issue.find(1) |
@@ -157,6 +157,7 class ApiTest::MembershipsTest < ActionController::IntegrationTest | |||||
157 | put '/memberships/2.xml', {:membership => {:user_id => 3, :role_ids => [1,2]}}, credentials('jsmith') |
|
157 | put '/memberships/2.xml', {:membership => {:user_id => 3, :role_ids => [1,2]}}, credentials('jsmith') | |
158 |
|
158 | |||
159 | assert_response :ok |
|
159 | assert_response :ok | |
|
160 | assert_equal '', @response.body | |||
160 | end |
|
161 | end | |
161 | member = Member.find(2) |
|
162 | member = Member.find(2) | |
162 | assert_equal [1,2], member.role_ids.sort |
|
163 | assert_equal [1,2], member.role_ids.sort | |
@@ -179,6 +180,7 class ApiTest::MembershipsTest < ActionController::IntegrationTest | |||||
179 | delete '/memberships/2.xml', {}, credentials('jsmith') |
|
180 | delete '/memberships/2.xml', {}, credentials('jsmith') | |
180 |
|
181 | |||
181 | assert_response :ok |
|
182 | assert_response :ok | |
|
183 | assert_equal '', @response.body | |||
182 | end |
|
184 | end | |
183 | assert_nil Member.find_by_id(2) |
|
185 | assert_nil Member.find_by_id(2) | |
184 | end |
|
186 | end |
@@ -226,6 +226,7 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||||
226 | put '/projects/2.xml', @parameters, credentials('jsmith') |
|
226 | put '/projects/2.xml', @parameters, credentials('jsmith') | |
227 | end |
|
227 | end | |
228 | assert_response :ok |
|
228 | assert_response :ok | |
|
229 | assert_equal '', @response.body | |||
229 | assert_equal 'application/xml', @response.content_type |
|
230 | assert_equal 'application/xml', @response.content_type | |
230 | project = Project.find(2) |
|
231 | project = Project.find(2) | |
231 | assert_equal 'API update', project.name |
|
232 | assert_equal 'API update', project.name | |
@@ -238,6 +239,7 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||||
238 | put '/projects/2.xml', @parameters, credentials('admin') |
|
239 | put '/projects/2.xml', @parameters, credentials('admin') | |
239 | end |
|
240 | end | |
240 | assert_response :ok |
|
241 | assert_response :ok | |
|
242 | assert_equal '', @response.body | |||
241 | project = Project.find(2) |
|
243 | project = Project.find(2) | |
242 | assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort |
|
244 | assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort | |
243 | end |
|
245 | end | |
@@ -249,6 +251,7 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||||
249 | put '/projects/2.xml', @parameters, credentials('admin') |
|
251 | put '/projects/2.xml', @parameters, credentials('admin') | |
250 | end |
|
252 | end | |
251 | assert_response :ok |
|
253 | assert_response :ok | |
|
254 | assert_equal '', @response.body | |||
252 | project = Project.find(2) |
|
255 | project = Project.find(2) | |
253 | assert_equal [1, 3], project.trackers.map(&:id).sort |
|
256 | assert_equal [1, 3], project.trackers.map(&:id).sort | |
254 | end |
|
257 | end | |
@@ -286,6 +289,7 class ApiTest::ProjectsTest < ActionController::IntegrationTest | |||||
286 | delete '/projects/2.xml', {}, credentials('admin') |
|
289 | delete '/projects/2.xml', {}, credentials('admin') | |
287 | end |
|
290 | end | |
288 | assert_response :ok |
|
291 | assert_response :ok | |
|
292 | assert_equal '', @response.body | |||
289 | assert_nil Project.find_by_id(2) |
|
293 | assert_nil Project.find_by_id(2) | |
290 | end |
|
294 | end | |
291 | end |
|
295 | end |
@@ -134,6 +134,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest | |||||
134 | put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, credentials('jsmith') |
|
134 | put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, credentials('jsmith') | |
135 | end |
|
135 | end | |
136 | assert_response :ok |
|
136 | assert_response :ok | |
|
137 | assert_equal '', @response.body | |||
137 | assert_equal 'API Update', TimeEntry.find(2).comments |
|
138 | assert_equal 'API Update', TimeEntry.find(2).comments | |
138 | end |
|
139 | end | |
139 | end |
|
140 | end | |
@@ -157,6 +158,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest | |||||
157 | delete '/time_entries/2.xml', {}, credentials('jsmith') |
|
158 | delete '/time_entries/2.xml', {}, credentials('jsmith') | |
158 | end |
|
159 | end | |
159 | assert_response :ok |
|
160 | assert_response :ok | |
|
161 | assert_equal '', @response.body | |||
160 | assert_nil TimeEntry.find_by_id(2) |
|
162 | assert_nil TimeEntry.find_by_id(2) | |
161 | end |
|
163 | end | |
162 | end |
|
164 | end |
@@ -238,6 +238,7 class ApiTest::UsersTest < ActionController::IntegrationTest | |||||
238 | assert !user.admin? |
|
238 | assert !user.admin? | |
239 |
|
239 | |||
240 | assert_response :ok |
|
240 | assert_response :ok | |
|
241 | assert_equal '', @response.body | |||
241 | end |
|
242 | end | |
242 | end |
|
243 | end | |
243 |
|
244 | |||
@@ -263,6 +264,7 class ApiTest::UsersTest < ActionController::IntegrationTest | |||||
263 | assert !user.admin? |
|
264 | assert !user.admin? | |
264 |
|
265 | |||
265 | assert_response :ok |
|
266 | assert_response :ok | |
|
267 | assert_equal '', @response.body | |||
266 | end |
|
268 | end | |
267 | end |
|
269 | end | |
268 | end |
|
270 | end | |
@@ -322,6 +324,7 class ApiTest::UsersTest < ActionController::IntegrationTest | |||||
322 | end |
|
324 | end | |
323 |
|
325 | |||
324 | assert_response :ok |
|
326 | assert_response :ok | |
|
327 | assert_equal '', @response.body | |||
325 | end |
|
328 | end | |
326 | end |
|
329 | end | |
327 |
|
330 | |||
@@ -337,6 +340,7 class ApiTest::UsersTest < ActionController::IntegrationTest | |||||
337 | end |
|
340 | end | |
338 |
|
341 | |||
339 | assert_response :ok |
|
342 | assert_response :ok | |
|
343 | assert_equal '', @response.body | |||
340 | end |
|
344 | end | |
341 | end |
|
345 | end | |
342 | end |
|
346 | end |
@@ -120,6 +120,7 class ApiTest::VersionsTest < ActionController::IntegrationTest | |||||
120 | put '/versions/2.xml', {:version => {:name => 'API update'}}, credentials('jsmith') |
|
120 | put '/versions/2.xml', {:version => {:name => 'API update'}}, credentials('jsmith') | |
121 |
|
121 | |||
122 | assert_response :ok |
|
122 | assert_response :ok | |
|
123 | assert_equal '', @response.body | |||
123 | assert_equal 'API update', Version.find(2).name |
|
124 | assert_equal 'API update', Version.find(2).name | |
124 | end |
|
125 | end | |
125 | end |
|
126 | end | |
@@ -131,6 +132,7 class ApiTest::VersionsTest < ActionController::IntegrationTest | |||||
131 | end |
|
132 | end | |
132 |
|
133 | |||
133 | assert_response :ok |
|
134 | assert_response :ok | |
|
135 | assert_equal '', @response.body | |||
134 | assert_nil Version.find_by_id(3) |
|
136 | assert_nil Version.find_by_id(3) | |
135 | end |
|
137 | end | |
136 | end |
|
138 | end |
General Comments 0
You need to be logged in to leave comments.
Login now