Skip to content

Conversation

@nerisa
Copy link

@nerisa nerisa commented Nov 17, 2025

Summary

This PR adds support for Rack 3.x and Rails 8.1+ to the sbmt-pact gem. The main issue is that Rack 3 removed Rack::Handler::WEBrick and moved it to the separate rackup gem.

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

  • Changed Rack dependency from ~> 2.0 to >= 2.0, < 4 (supports both Rack 2 and 3)
  • Added rackup gem as a dependency

2. Updated lib/sbmt/pact/provider/http_server.rb

  • Added require "rackup/handler/webrick"
  • Changed Rack::Handler::WEBrick to Rackup::Handler::WEBrick

3. Updated lib/sbmt/pact/provider/pact_broker_proxy_runner.rb

  • Added require "rackup/handler/webrick"
  • Changed Rack::Handler::WEBrick to Rackup::Handler::WEBrick

Testing

All 60 existing tests pass successfully with these changes:

Finished in 0.21415 seconds (files took 4.15 seconds to load)
60 examples, 0 failures

The changes maintain backward compatibility with Rack 2.x while adding support for Rack 3.x.

Compatibility

  • ✅ Backward compatible with Rack 2.x
  • ✅ Forward compatible with Rack 3.x
  • ✅ All existing functionality preserved
  • ✅ No breaking changes

Additional Notes

These are the only breaking changes between Rack 2 and Rack 3 that affect this gem:

  • Rack::Handler::WEBrick moved to Rackup::Handler::WEBrick
  • Other Rack APIs (Rack::Request, Rack::CONTENT_LENGTH) remain unchanged
  • The rack-proxy gem already supports Rack 3

This change enables users to use sbmt-pact with Rails 8.0+ applications.


This PR was created with assistance from Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant