Skip to content

Commit

Permalink
Only use Rackup when rack > 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Jul 21, 2024
1 parent c1831ab commit 1ebf739
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/support/vcr_localhost_server.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'rack'
require 'rackup'
require 'rackup' if Rack.release > '3.0'
require 'net/http'
require 'webrick'

Expand Down Expand Up @@ -45,7 +45,12 @@ def boot
# Use WEBrick since it's part of the ruby standard library and is available on all ruby interpreters.
options = { :Port => port, :ShutdownSocketWithoutClose => true }
options.merge!(:AccessLog => [], :Logger => WEBrick::BasicLog.new(StringIO.new)) unless ENV['VERBOSE_SERVER']
Rackup::Handler::WEBrick.run(Identify.new(@rack_app), **options)

if defined?(Rackup)
Rackup::Handler::WEBrick.run(Identify.new(@rack_app), **options)
else
Rack::Handler::WEBrick.run(Identify.new(@rack_app), **options)
end
end

def booted?
Expand Down

0 comments on commit 1ebf739

Please sign in to comment.