summaryrefslogtreecommitdiff
path: root/test/cgi/test_cgi_util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/cgi/test_cgi_util.rb')
-rw-r--r--test/cgi/test_cgi_util.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb
index 802379d..2c5182b 100644
--- a/test/cgi/test_cgi_util.rb
+++ b/test/cgi/test_cgi_util.rb
@@ -1,21 +1,25 @@
require 'test/unit'
require 'cgi'
require 'stringio'
+require_relative 'update_env'
class CGIUtilTest < Test::Unit::TestCase
include CGI::Util
+ include UpdateEnv
def setup
- ENV['REQUEST_METHOD'] = 'GET'
+ @environ = {}
+ update_env(
+ 'REQUEST_METHOD' => 'GET',
+ 'SCRIPT_NAME' => nil,
+ )
@str1="&<>\" \xE3\x82\x86\xE3\x82\x93\xE3\x82\x86\xE3\x82\x93"
@str1.force_encoding("UTF-8") if defined?(::Encoding)
end
def teardown
- %W[REQUEST_METHOD SCRIPT_NAME].each do |name|
- ENV.delete(name)
- end
+ ENV.update(@environ)
end