Skip to content

Commit

Permalink
added test cases for user and file config of log_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Christie committed Nov 19, 2019
1 parent c109a02 commit 8b9429e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/test_rack_handler.rb
Expand Up @@ -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

0 comments on commit 8b9429e

Please sign in to comment.