Skip to content

Commit 8d3b0f8

Browse files
committed
HaveHttpStatus uses Rack's public API
Instead of accessing a Constant that isn't a documented part of the Rack API, get the status code for a status name using Rack's supported public API.
1 parent e65348e commit 8d3b0f8

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/rspec/rails/matchers/have_http_status.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,7 @@ def pp_status(status, code)
216216
# @see Rack::Utils::SYMBOL_TO_STATUS_CODE
217217
# @raise [ArgumentError] if an associated code could not be found
218218
def set_expected_code!
219-
@expected ||=
220-
Rack::Utils::SYMBOL_TO_STATUS_CODE.fetch(expected_status) do
221-
raise ArgumentError,
222-
"Invalid HTTP status: #{expected_status.inspect}"
223-
end
219+
@expected ||= Rack::Utils.status_code(expected_status)
224220
end
225221
end
226222

0 commit comments

Comments
 (0)