From 36d0fa866ac696ee8acde74f2cffccd06ab8e816 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 20 Mar 2010 19:46:44 -0700 Subject: tests: fix to run under Ruby 1.9.2dev Avoid Tempfile.new(nil), which breaks under Ruby 1.9.2 and was probably a bad idea to begin with. --- test/rails/test_rails.rb | 2 +- test/unit/test_util.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/rails/test_rails.rb b/test/rails/test_rails.rb index 304f519..6742722 100644 --- a/test/rails/test_rails.rb +++ b/test/rails/test_rails.rb @@ -234,7 +234,7 @@ logger Logger.new('#{COMMON_TMP.path}') def test_alt_url_root_config_env # cbf to actually work on this since I never use this feature (ewong) return unless ROR_V[0] >= 2 && ROR_V[1] >= 3 - tmp = Tempfile.new(nil) + tmp = Tempfile.new('') tmp.syswrite("ENV['RAILS_RELATIVE_URL_ROOT'] = '/poo'\n") redirect_test_io do @pid = fork { exec 'unicorn_rails', "-l#@addr:#@port", "-c", tmp.path } diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb index 4a1e21f..b267179 100644 --- a/test/unit/test_util.rb +++ b/test/unit/test_util.rb @@ -7,7 +7,7 @@ class TestUtil < Test::Unit::TestCase EXPECT_FLAGS = File::WRONLY | File::APPEND def test_reopen_logs_noop - tmp = Tempfile.new(nil) + tmp = Tempfile.new('') tmp.reopen(tmp.path, 'a') tmp.sync = true ext = tmp.external_encoding rescue nil @@ -21,14 +21,14 @@ class TestUtil < Test::Unit::TestCase end def test_reopen_logs_renamed - tmp = Tempfile.new(nil) + tmp = Tempfile.new('') tmp_path = tmp.path.freeze tmp.reopen(tmp_path, 'a') tmp.sync = true ext = tmp.external_encoding rescue nil int = tmp.internal_encoding rescue nil before = tmp.stat.inspect - to = Tempfile.new(nil) + to = Tempfile.new('') File.rename(tmp_path, to.path) assert ! File.exist?(tmp_path) Unicorn::Util.reopen_logs @@ -45,7 +45,7 @@ class TestUtil < Test::Unit::TestCase end def test_reopen_logs_renamed_with_encoding - tmp = Tempfile.new(nil) + tmp = Tempfile.new('') tmp_path = tmp.path.dup.freeze Encoding.list.each { |encoding| File.open(tmp_path, "a:#{encoding.to_s}") { |fp| @@ -68,7 +68,7 @@ class TestUtil < Test::Unit::TestCase end if STDIN.respond_to?(:external_encoding) def test_reopen_logs_renamed_with_internal_encoding - tmp = Tempfile.new(nil) + tmp = Tempfile.new('') tmp_path = tmp.path.dup.freeze Encoding.list.each { |ext| Encoding.list.each { |int| -- cgit v1.2.3-24-ge0c7