diff --git a/test/test_rack_handler.rb b/test/test_rack_handler.rb index 81790804fc..383c504694 100644 --- a/test/test_rack_handler.rb +++ b/test/test_rack_handler.rb @@ -226,4 +226,39 @@ def test_user_port_wins_over_config end end end + + def test_file_log_requests_wins_over_deafult_config + file_log_requests_config = true + + Dir.mktmpdir do |d| + Dir.chdir(d) do + FileUtils.mkdir("config") + File.open("config/puma.rb", "w") { |f| f << "log_requests #{file_log_requests_config}" } + + conf = Rack::Handler::Puma.config(->{}, @options) + conf.load + + assert_equal file_log_requests_config, conf.options[:log_requests] + end + end + end + + + def test_user_log_requests_wins_over_file_config + file_log_requests_config = true + user_log_requests_config = true + + Dir.mktmpdir do |d| + Dir.chdir(d) do + FileUtils.mkdir("config") + File.open("config/puma.rb", "w") { |f| f << "log_requests #{file_log_requests_config}" } + + @options[:log_requests] = user_log_requests_config + conf = Rack::Handler::Puma.config(->{}, @options) + conf.load + + assert_equal user_log_requests_config, conf.options[:log_requests] + end + end + end end