1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Added tests for bind configuration on rackup file

see b8c087d967
see #684
see #689
This commit is contained in:
Laurent Arnoud 2015-04-29 20:51:25 +02:00
parent 6479e6b26b
commit 8662c6c877
3 changed files with 13 additions and 1 deletions

View file

@ -105,7 +105,7 @@ module Puma
@options.merge!(rack_options)
config_ru_binds = rack_options.each_with_object([]) do |(k, v), b|
b << v if k.to_s[0,4] == "bind"
b << v if k.to_s.start_with?("bind")
end
@options[:binds] = config_ru_binds unless config_ru_binds.empty?

2
test/hello-bind.ru Normal file
View file

@ -0,0 +1,2 @@
#\ -O bind=tcp://127.0.0.1:9292
run lambda { |env| [200, {"Content-Type" => "text/plain"}, ["Hello World"]] }

View file

@ -4,6 +4,16 @@ require 'puma'
require 'puma/configuration'
class TestConfigFile < Test::Unit::TestCase
def test_app_from_rackup
opts = {:rackup => "test/hello-bind.ru"}
conf = Puma::Configuration.new opts
conf.load
conf.app
assert_equal ["tcp://127.0.0.1:9292"], conf.options[:binds]
end
def test_app_from_app_DSL
opts = { :config_file => "test/config/app.rb" }
conf = Puma::Configuration.new opts