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 ee9f4d9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ group :test do
gem 'faraday', '~>2.0'
gem 'faraday-retry', '~>2.0'
gem 'rackup', '~> 2.1'
gem 'rack', '>= 3.0', '< 4.0'
end
12 changes: 12 additions & 0 deletions spec/lib/rack/webrick.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Rack
module Handler
begin
require 'rack/handler/webrick'
WEBrick = Class.new(Rack::Handler::WEBrick)
rescue LoadError
require 'rackup/handler/webrick'
WEBrick = Class.new(Rackup::Handler::WEBrick)
end
end
end

19 changes: 14 additions & 5 deletions spec/support/ssl_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ def webrick_opts port
require "webrick"
require "webrick/https"
require "rack"
require "rackup/handler/webrick"
begin
# For rack <= 3.0.x
require 'rack/handler/webrick'
opts = webrick_opts(4444)
Rack::Handler::WEBrick.run(app, **opts) do |server|
@server = server
end
rescue LoadError
# For rack >= 3.1.x
require 'rackup/handler/webrick'
opts = webrick_opts(4444)

opts = webrick_opts(4444)

Rack::Handler::WEBrick.run(app, **opts) do |server|
@server = server
Rackup::Handler::WEBrick.run(app, **opts) do |server|
@server = server
end
end
end

0 comments on commit ee9f4d9

Please sign in to comment.