diff --git a/Changelog.md b/Changelog.md index b420bba86..7bfe8f616 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Bug Fixes: * Reset `ActiveSupport::CurrentAttributes` between examples. (Javier Julio, #2752) * Fix a broken link in generated mailer previews. (Chiara Núñez, #2764) +* Have HttpStatusMatcher use Rack's public API for http status code. (Darren Boyd, #2763) ### 6.1.2 / 2024-03-19 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...v6.1.2) diff --git a/lib/rspec/rails/matchers/have_http_status.rb b/lib/rspec/rails/matchers/have_http_status.rb index 858ef547b..878ceadc7 100644 --- a/lib/rspec/rails/matchers/have_http_status.rb +++ b/lib/rspec/rails/matchers/have_http_status.rb @@ -216,11 +216,7 @@ def pp_status(status, code) # @see Rack::Utils::SYMBOL_TO_STATUS_CODE # @raise [ArgumentError] if an associated code could not be found def set_expected_code! - @expected ||= - Rack::Utils::SYMBOL_TO_STATUS_CODE.fetch(expected_status) do - raise ArgumentError, - "Invalid HTTP status: #{expected_status.inspect}" - end + @expected ||= Rack::Utils.status_code(expected_status) end end