Skip to content

Commit

Permalink
fix(deps): rack 2.2.6 + ruby 3 change to WEBrick.run for args
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed May 5, 2023
1 parent 027ba54 commit 9ac818f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/support/provider_with_self_signed_cert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ def run_provider_with_self_signed_cert port
require 'webrick/https'

webrick_opts = {:Port => port, :SSLEnable => true, :SSLCertName => [%w[CN localhost]]}
Rack::Handler::WEBrick.run(Provider, webrick_opts) do |server|
@server = server
# https://www.rubydoc.info/gems/rack/2.2.6/Rack%2FHandler%2FWEBrick.run
if RUBY_VERSION < "3"
# To work with Ruby 2.7.0, this needs an explicit ruby2_keywords
Rack::Handler::WEBrick.run(Provider, webrick_opts) do |server|
@server = server
end
else
Rack::Handler::WEBrick.run(Provider, **webrick_opts) do |server|
@server = server
end
end
end

Expand Down

0 comments on commit 9ac818f

Please sign in to comment.