Skip to content

Commit c6a3d83

Browse files
pirjJonRowe
authored andcommitted
Merge pull request #2765 from darrenboyd/rack-public-api-use
HaveHttpStatus uses Rack's public API
1 parent 4e8c259 commit c6a3d83

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Bug Fixes:
55

66
* Reset `ActiveSupport::CurrentAttributes` between examples. (Javier Julio, #2752)
77
* Fix a broken link in generated mailer previews. (Chiara Núñez, #2764)
8+
* Have HttpStatusMatcher use Rack's public API for http status code. (Darren Boyd, #2763)
89

910
### 6.1.2 / 2024-03-19
1011
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...v6.1.2)

lib/rspec/rails/matchers/have_http_status.rb

Lines changed: 1 addition & 5 deletions
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)