Fix "ArgumentError: Invalid response name: unprocessable_entity" with Rack 3.1.0+ in assert_response (#39889).

Rack 3.1.0 changed the symbol for HTTP status code 422 from `:unprocessable_entity` to `:unprocessable_content`.
Due to the change, `assert_response(:unprocessable_entity, ...)` raises ArgumentError with Rack 3.1.0+.

This fix is a follow-up to r22837.


git-svn-id: https://svn.redmine.org/redmine/trunk@22876 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-06-12 16:09:37 +00:00
parent e41bc39322
commit b803bddb1f
33 changed files with 56 additions and 55 deletions

View File

@@ -417,7 +417,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
:headers => credentials('admin'))
end
assert_response :unprocessable_entity
assert_response :unprocessable_content
assert_equal 'application/xml', @response.media_type
assert_select 'errors error', :text => "First name cannot be blank"
end
@@ -434,7 +434,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
:headers => credentials('admin'))
end
assert_response :unprocessable_entity
assert_response :unprocessable_content
assert_equal 'application/json', @response.media_type
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json
@@ -503,7 +503,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
:headers => credentials('admin'))
end
assert_response :unprocessable_entity
assert_response :unprocessable_content
assert_equal 'application/xml', @response.media_type
assert_select 'errors error', :text => "First name cannot be blank"
end
@@ -521,7 +521,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
:headers => credentials('admin'))
end
assert_response :unprocessable_entity
assert_response :unprocessable_content
assert_equal 'application/json', @response.media_type
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json