-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update URLMap Regexp usage for Ruby v3.3 (#3165)
* update URLMap Regexp usage for Ruby v3.3 Ruby v3.3.0-preview1 doesn't support passing 3 arguments to `Regexp.new`, so update `URLMap` to use a 2 argument version instead. * Add unit test for PR 3165 With a `Gemfile` that excludes `rack`, have Puma use its own `URLMap` class to handle the mapping of the route defined in `config.ru`. Without the fix provided by PR 3165, this new test will time out. * test_url_map.rb - run single * test/url_map_test/config.ru - check whether Rack::URLMap is defined Just in case... --------- Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
- Loading branch information
Showing
4 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require_relative "helper" | ||
require_relative "helpers/integration" | ||
|
||
class TestURLMap < TestIntegration | ||
|
||
def teardown | ||
return if skipped? | ||
super | ||
end | ||
|
||
# make sure the mapping defined in url_map_test/config.ru works | ||
def test_basic_url_mapping | ||
skip_if :jruby | ||
env = { "BUNDLE_GEMFILE" => "#{__dir__}/url_map_test/Gemfile" } | ||
Dir.chdir("#{__dir__}/url_map_test") do | ||
cli_server set_pumactl_args, env: env | ||
end | ||
connection = connect("/ok") | ||
# Puma 6.2.2 and below will time out here with Ruby v3.3 | ||
# see https://github.com/puma/puma/pull/3165 | ||
body = read_body(connection, 1) | ||
assert_equal("OK", body) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gem 'puma', path: '../..' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
map "/ok" do | ||
run ->(env) { | ||
if Object.const_defined?(:Rack) && ::Rack.const_defined?(:URLMap) | ||
[200, {}, ["::Rack::URLMap is loaded"]] | ||
else | ||
[200, {}, ["OK"]] | ||
end | ||
} | ||
end |