summaryrefslogtreecommitdiff
path: root/test/cgi/test_cgi_multipart.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-12 14:57:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-12 14:57:33 +0000
commit05c29680e515c000552008f725747261ffa6008d (patch)
tree4ad6c4c057ec68f3d7b396a8fa55022f45ee274c /test/cgi/test_cgi_multipart.rb
parent31eb1938832eb3a3a69c7246db151c96b589b877 (diff)
fix env leaks
* lib/rubygems/test_case.rb (setup, teardown): fix environment variable change leaks. * test/cgi/update_env.rb: ditto. * test/rake/test_rake_application_options.rb (setup, teardown): ditto. * test/rake/test_rake_file_utils.rb (setup, teardown): ditto. * test/rubygems/test_gem_request.rb (setup): add https_proxy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/cgi/test_cgi_multipart.rb')
-rw-r--r--test/cgi/test_cgi_multipart.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/cgi/test_cgi_multipart.rb b/test/cgi/test_cgi_multipart.rb
index 1325798e95f..989c054f8a0 100644
--- a/test/cgi/test_cgi_multipart.rb
+++ b/test/cgi/test_cgi_multipart.rb
@@ -2,6 +2,7 @@ require 'test/unit'
require 'cgi'
require 'tempfile'
require 'stringio'
+require_relative 'update_env'
##
@@ -104,16 +105,21 @@ end
class CGIMultipartTest < Test::Unit::TestCase
+ include UpdateEnv
+
def setup
- ENV['REQUEST_METHOD'] = 'POST'
+ @environ = {}
+ update_env(
+ 'REQUEST_METHOD' => 'POST',
+ 'CONTENT_TYPE' => nil,
+ 'CONTENT_LENGTH' => nil,
+ )
@tempfiles = []
end
def teardown
- %w[ REQUEST_METHOD CONTENT_TYPE CONTENT_LENGTH REQUEST_METHOD ].each do |name|
- ENV.delete(name)
- end
+ ENV.update(@environ)
$stdin.close() if $stdin.is_a?(Tempfile)
$stdin = STDIN
@tempfiles.each {|t|