From 58287b2fc4264f19c3aa083c92a1058764b7bb81 Mon Sep 17 00:00:00 2001 From: sthirugn Date: Fri, 1 May 2020 17:56:26 -0400 Subject: [PATCH] Removing Dir.mktmpdir since windows 2.2/2.3 doesnt like it --- test/test_launcher.rb | 65 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/test/test_launcher.rb b/test/test_launcher.rb index 2f195a6c85..b2d2005294 100644 --- a/test/test_launcher.rb +++ b/test/test_launcher.rb @@ -80,51 +80,54 @@ def test_pid_file end def test_state_permission_0640 - Dir.mktmpdir do |dir| - tmp_path = File.join(dir, "puma-state") - Tempfile.new(tmp_path) - tmp_permission = 0640 - - conf = Puma::Configuration.new do |c| - c.state_path tmp_path - c.state_permission tmp_permission - end - - launcher(conf).write_state + tmp_file = Tempfile.new("puma-test") + tmp_path = tmp_file.path + tmp_file.close! + tmp_permission = 0640 - assert File.stat(tmp_path).mode.to_s(8)[-4..-1], tmp_permission + conf = Puma::Configuration.new do |c| + c.state_path tmp_path + c.state_permission tmp_permission end + + launcher(conf).write_state + + assert File.stat(tmp_path).mode.to_s(8)[-4..-1], tmp_permission + + File.unlink tmp_path end def test_state_permission_nil - Dir.mktmpdir do |dir| - tmp_path = File.join(dir, "puma-state") - Tempfile.new(tmp_path) + tmp_file = Tempfile.new("puma-test") + tmp_path = tmp_file.path + tmp_file.close! - conf = Puma::Configuration.new do |c| - c.state_path tmp_path - c.state_permission nil - end + conf = Puma::Configuration.new do |c| + c.state_path tmp_path + c.state_permission nil + end + + launcher(conf).write_state - launcher(conf).write_state + assert File.exist?(tmp_path) - assert File.exist?(tmp_path) - end + File.unlink tmp_path end def test_no_state_permission - Dir.mktmpdir do |dir| - tmp_path = File.join(dir, "puma-state") - Tempfile.new(tmp_path) + tmp_file = Tempfile.new("puma-test") + tmp_path = tmp_file.path + tmp_file.close! - conf = Puma::Configuration.new do |c| - c.state_path tmp_path - end + conf = Puma::Configuration.new do |c| + c.state_path tmp_path + end - launcher(conf).write_state + launcher(conf).write_state - assert File.exist?(tmp_path) - end + assert File.exist?(tmp_path) + + File.unlink tmp_path end def test_puma_stats