Add Rack 3 and Rails 8.1 support #3
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for Rack 3.x and Rails 8.1+ to the
sbmt-pactgem. The main issue is that Rack 3 removedRack::Handler::WEBrickand moved it to the separaterackupgem.Motivation
Rails 8.0+ requires Rack 3.x, and the current version of sbmt-pact only supports Rack 2.x. This prevents users from using the gem with modern Rails applications.
Changes Made
1. Updated
sbmt-pact.gemspec~> 2.0to>= 2.0, < 4(supports both Rack 2 and 3)rackupgem as a dependency2. Updated
lib/sbmt/pact/provider/http_server.rbrequire "rackup/handler/webrick"Rack::Handler::WEBricktoRackup::Handler::WEBrick3. Updated
lib/sbmt/pact/provider/pact_broker_proxy_runner.rbrequire "rackup/handler/webrick"Rack::Handler::WEBricktoRackup::Handler::WEBrickTesting
All 60 existing tests pass successfully with these changes:
The changes maintain backward compatibility with Rack 2.x while adding support for Rack 3.x.
Compatibility
Additional Notes
These are the only breaking changes between Rack 2 and Rack 3 that affect this gem:
Rack::Handler::WEBrickmoved toRackup::Handler::WEBrickRack::Request,Rack::CONTENT_LENGTH) remain unchangedrack-proxygem already supports Rack 3This change enables users to use
sbmt-pactwith Rails 8.0+ applications.This PR was created with assistance from Claude Code