Skip to content

Commit

Permalink
Simplify the patch code
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Kuchin <[email protected]>
  • Loading branch information
cbliard and toy authored Jun 24, 2024
1 parent a885fef commit c048e11
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions spec/support/have_http_status_with_rack_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def as_test_response(obj)
# `have_http_status` matcher would fail if the response object is a
# `Rack::MockResponse`. Hack to disguise `Rack::MockResponse` into a
# `ActionDispatch::TestResponse` object.
obj = ActionDispatch::Response.new(obj.status, obj.headers, obj.body).tap do |resp|
resp.request = ActionDispatch::Request.new({})
end
::ActionDispatch::TestResponse.from_response(obj)
response = ActionDispatch::Response.new(obj.status, obj.headers, obj.body)
response.request = ActionDispatch::Request.new({})
::ActionDispatch::TestResponse.from_response(response)
else
super
end
Expand Down

0 comments on commit c048e11

Please sign in to comment.