Skip to content

Commit ffd99ac

Browse files
authored
Fix warnings about deprecated :unprocessable_entity (#1288)
The IETF revised the name of status code 422 to "Unprocessable Content" and Rack also renamed the symbol used for the same status code. The previous symbol (`:unprocessable_entity`) has been deprecated and now logs lots of warnings. This fixes all the uses of it in our code, although we still get warnings from within Rails and WebMock.
1 parent 714320b commit ffd99ac

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/controllers/api/v0/annotations_controller_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Api::V0::AnnotationsControllerTest < ActionDispatch::IntegrationTest
168168
as: :json,
169169
params: { 'priority' => 1.1 }
170170
)
171-
assert_response :unprocessable_entity
171+
assert_response :unprocessable_content
172172
assert_not_equal(
173173
1.1,
174174
page.versions[0].change_from_previous.priority,
@@ -180,7 +180,7 @@ class Api::V0::AnnotationsControllerTest < ActionDispatch::IntegrationTest
180180
as: :json,
181181
params: { 'priority' => -1 }
182182
)
183-
assert_response :unprocessable_entity
183+
assert_response :unprocessable_content
184184
assert_not_equal(
185185
-1,
186186
page.versions[0].change_from_previous.priority,
@@ -197,7 +197,7 @@ class Api::V0::AnnotationsControllerTest < ActionDispatch::IntegrationTest
197197
as: :json,
198198
params: { 'significance' => 1.1 }
199199
)
200-
assert_response :unprocessable_entity
200+
assert_response :unprocessable_content
201201
assert_not_equal(
202202
1.1,
203203
page.versions[0].change_from_previous.priority,
@@ -209,7 +209,7 @@ class Api::V0::AnnotationsControllerTest < ActionDispatch::IntegrationTest
209209
as: :json,
210210
params: { 'significance' => -1 }
211211
)
212-
assert_response :unprocessable_entity
212+
assert_response :unprocessable_content
213213
assert_not_equal(
214214
-1,
215215
page.versions[0].change_from_previous.priority,
@@ -328,7 +328,7 @@ class Api::V0::AnnotationsControllerTest < ActionDispatch::IntegrationTest
328328
params: '{}'
329329
)
330330

331-
assert_response :unprocessable_entity
331+
assert_response :unprocessable_content
332332
body = JSON.parse(@response.body)
333333
assert(body.key?('errors'), 'Response should have an "errors" property')
334334
end

test/controllers/api/v0/urls_controller_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Api::V0::UrlsControllerTest < ActionDispatch::IntegrationTest
149149
as: :json,
150150
params: { page_url: { url: 'https://example.gov/some_new_url' } }
151151
)
152-
assert_response :unprocessable_entity
152+
assert_response :unprocessable_content
153153
assert_equal 'application/json', @response.media_type
154154
end
155155

@@ -178,7 +178,7 @@ class Api::V0::UrlsControllerTest < ActionDispatch::IntegrationTest
178178
as: :json,
179179
params: { page_url: { from_time: 'This is not a time' } }
180180
)
181-
assert_response :unprocessable_entity
181+
assert_response :unprocessable_content
182182
assert_equal 'application/json', @response.media_type
183183
end
184184

@@ -208,7 +208,7 @@ class Api::V0::UrlsControllerTest < ActionDispatch::IntegrationTest
208208

209209
sign_in users(:alice)
210210
delete(api_v0_page_url_path(pages(:home_page), page_url))
211-
assert_response :unprocessable_entity
211+
assert_response :unprocessable_content
212212
assert_equal 'application/json', @response.media_type
213213
end
214214
end

0 commit comments

Comments
 (0)