mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
ruby 1.8.7 compatibility patches
1.8.7 doesn't have each_with_object, rand(range) or 1.9 hash syntax
This commit is contained in:
parent
7e5b788610
commit
69449dc23a
3 changed files with 4 additions and 3 deletions
|
@ -104,8 +104,9 @@ module Puma
|
|||
rack_app, rack_options = Puma::Rack::Builder.parse_file(rackup)
|
||||
@options.merge!(rack_options)
|
||||
|
||||
config_ru_binds = rack_options.each_with_object([]) do |(k, v), b|
|
||||
config_ru_binds = rack_options.inject([]) do |b, (k, v)|
|
||||
b << v if k.to_s.start_with?("bind")
|
||||
b
|
||||
end
|
||||
@options[:binds] = config_ru_binds unless config_ru_binds.empty?
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class TestConfigFile < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_double_bind_port
|
||||
port = rand(30_000..40_000).to_s
|
||||
port = (rand(10_000) + 30_000).to_s
|
||||
with_env("PORT" => port) do
|
||||
opts = { :binds => ["tcp://#{Configuration::DefaultTCPHost}:#{port}"], :config_file => "test/config/app.rb"}
|
||||
conf = Puma::Configuration.new opts
|
||||
|
|
|
@ -191,7 +191,7 @@ class TestPumaServer < Test::Unit::TestCase
|
|||
def test_prints_custom_error
|
||||
@events = Puma::Events.strings
|
||||
re = lambda { |err| [302, {'Content-Type' => 'text', 'Location' => 'foo.html'}, ['302 found']] }
|
||||
@server = Puma::Server.new @app, @events, {lowlevel_error_handler: re}
|
||||
@server = Puma::Server.new @app, @events, {:lowlevel_error_handler => re}
|
||||
|
||||
@server.app = proc { |e| raise "don't leak me bro" }
|
||||
@server.add_tcp_listener @host, @port
|
||||
|
|
Loading…
Reference in a new issue