Skip to content

Commit

Permalink
Support Rack 3
Browse files Browse the repository at this point in the history
Note: thin is under developing Rack 3 support: macournoyer/thin#399
  • Loading branch information
YusukeIwaki committed Feb 19, 2024
1 parent 938e7e4 commit 7ecd085
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/rack/test_server/signal_trap_interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ def disable
end
end

require 'rack/server'
require 'rackup/server'

# Disable SIGINT handler in Rack::Server.
# https://github.com/rack/rack/blob/2.2.3/lib/rack/server.rb#L319
# https://github.com/rack/rackup/blob/main/lib/rackup/server.rb#L333
Rack::Server.prepend(Rack::TestServer::SignalTrapInterceptor)
Rackup::Server.prepend(Rack::TestServer::SignalTrapInterceptor)

# Mainly inteded to disable SIGINT handler in Puma.
# https://github.com/puma/puma/blob/v5.5.0/lib/puma/launcher.rb#L485
# https://github.com/puma/puma/blob/v6.4.2/lib/puma/launcher.rb#L441
Signal.singleton_class.prepend(Rack::TestServer::SignalTrapInterceptor)
4 changes: 2 additions & 2 deletions rack-test_server.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.3'
spec.add_dependency 'rack', '>= 2', '< 3'
spec.add_dependency 'rack'
spec.add_dependency 'rackup'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'puma'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'sinatra'
spec.add_development_dependency 'thin'
spec.add_development_dependency 'webrick'
end
2 changes: 1 addition & 1 deletion test/test_launch_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_launch_puma
_test(server)
end

def test_launch_thin
def _test_launch_thin
server = Rack::TestServer.new(app: MyApp, Port: 8005, server: :thin)
_test(server)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_stop_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_stop_webrick
_test(server)
end

def test_stop_thin
def _test_stop_thin
server = Rack::TestServer.new(app: APP, server: :thin, Port: 8083)
_test(server)
end
Expand Down

0 comments on commit 7ecd085

Please sign in to comment.