Skip to content

Commit

Permalink
test: upgrade to rack 3.x and add workaround to rack 3.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jun 15, 2024
1 parent 4e6cd94 commit 3bfd399
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
matrix:
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
rack_version: ["2", "3"]
env:
RACK_VERSION: ${{ matrix.rack_version }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand Down
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ end
group :test do
gem 'faraday', '~>2.0'
gem 'faraday-retry', '~>2.0'
gem 'rackup', '~> 2.1'
if ENV['RACK_VERSION'] == '2'
gem 'rack', '>= 2.0', '< 3.0'
else
gem 'rack', '>= 2.0'
gem 'rackup', '~> 2.1'
end
end
15 changes: 10 additions & 5 deletions spec/support/ssl_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ def webrick_opts port
require "webrick"
require "webrick/https"
require "rack"
require "rackup/handler/webrick"

opts = webrick_opts(4444)

Rack::Handler::WEBrick.run(app, **opts) do |server|
begin
require 'rackup/handler/webrick'
opts = webrick_opts(4444)
PactWEBrick = Rackup::Handler::WEBrick
rescue LoadError
require 'rack/handler/webrick'
PactWEBrick = Rack::Handler::WEBrick
opts = webrick_opts(4444)
end
server = PactWEBrick.run(app, **opts) do |server|
@server = server
end
end

0 comments on commit 3bfd399

Please sign in to comment.