mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Failing test of desired behavior
This commit is contained in:
parent
6dde986e10
commit
c946d15dc2
1 changed files with 38 additions and 0 deletions
|
@ -54,4 +54,42 @@ class TestPathHandler < Minitest::Test
|
|||
end
|
||||
end
|
||||
|
||||
def test_user_supplied_port_wins_over_config_file
|
||||
user_port = 5001
|
||||
file_port = 6001
|
||||
options = {}
|
||||
|
||||
Tempfile.open("puma.rb") do |f|
|
||||
f.puts "port #{file_port}"
|
||||
f.close
|
||||
|
||||
options[:config_files] = [f.path]
|
||||
options[:user_supplied_options] = [:Port]
|
||||
options[:Port] = user_port
|
||||
|
||||
conf = Rack::Handler::Puma.config(app, options)
|
||||
conf.load
|
||||
assert_equal ["tcp://0.0.0.0:#{user_port}"], conf.options[:binds]
|
||||
end
|
||||
end
|
||||
|
||||
def test_default_port_loses_to_config_file
|
||||
user_port = 5001
|
||||
file_port = 6001
|
||||
options = {}
|
||||
|
||||
Tempfile.open("puma.rb") do |f|
|
||||
f.puts "port #{file_port}"
|
||||
f.close
|
||||
|
||||
options[:config_files] = [f.path]
|
||||
options[:user_supplied_options] = []
|
||||
options[:Port] = user_port
|
||||
|
||||
conf = Rack::Handler::Puma.config(app, options)
|
||||
conf.load
|
||||
puts conf.options[:binds]
|
||||
assert_equal ["tcp://0.0.0.0:#{file_port}"], conf.options[:binds]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue