Skip to content

Commit 3bf5af1

Browse files
author
Sam Phippen
committed
Fixup have_http_status matcher header assignment.
We now have to mutate, instead of assigning, headers in the resp.headers property here.
1 parent 8fda9e9 commit 3bf5af1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/rspec/rails/matchers/have_http_status.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ def as_test_response(obj)
4343
# Capybara or catch `NameError`s for the undefined constants
4444
obj = ActionDispatch::Response.new.tap do |resp|
4545
resp.status = obj.status_code
46-
resp.headers = obj.response_headers
46+
resp.headers.clear
47+
resp.headers.merge!(obj.response_headers)
4748
resp.body = obj.body
49+
resp.request = ActionDispatch::Request.new({})
4850
end
4951
::ActionDispatch::TestResponse.from_response(obj)
5052
else

0 commit comments

Comments
 (0)