summaryrefslogtreecommitdiff
path: root/test/cgi/test_cgi_modruby.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/cgi/test_cgi_modruby.rb')
-rw-r--r--test/cgi/test_cgi_modruby.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/cgi/test_cgi_modruby.rb b/test/cgi/test_cgi_modruby.rb
index b41b9bd007..90132962b5 100644
--- a/test/cgi/test_cgi_modruby.rb
+++ b/test/cgi/test_cgi_modruby.rb
@@ -1,17 +1,20 @@
+# frozen_string_literal: true
require 'test/unit'
require 'cgi'
+require_relative 'update_env'
class CGIModrubyTest < Test::Unit::TestCase
+ include UpdateEnv
def setup
- @environ = {
+ @environ = {}
+ update_env(
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'GET',
#'QUERY_STRING' => 'a=foo&b=bar',
- }
- ENV.update(@environ)
+ )
CGI.class_eval { const_set(:MOD_RUBY, true) }
Apache._reset()
#@cgi = CGI.new
@@ -20,7 +23,7 @@ class CGIModrubyTest < Test::Unit::TestCase
def teardown
- @environ.each do |key, val| ENV.delete(key) end
+ ENV.update(@environ)
CGI.class_eval { remove_const(:MOD_RUBY) }
end
@@ -30,7 +33,7 @@ class CGIModrubyTest < Test::Unit::TestCase
cgi = CGI.new
assert(req._setup_cgi_env_invoked?)
assert(! req._send_http_header_invoked?)
- actual = cgi.header
+ actual = cgi.http_header
assert_equal('', actual)
assert_equal('text/html', req.content_type)
assert(req._send_http_header_invoked?)
@@ -51,7 +54,7 @@ class CGIModrubyTest < Test::Unit::TestCase
}
assert(req._setup_cgi_env_invoked?)
assert(! req._send_http_header_invoked?)
- actual = cgi.header(options)
+ actual = cgi.http_header(options)
assert_equal('', actual)
assert_equal('image/gif', req.content_type)
assert_equal('403 Forbidden', req.status_line)
@@ -71,7 +74,7 @@ class CGIModrubyTest < Test::Unit::TestCase
'status' => '200 OK',
'location' => 'http://www.example.com/',
}
- cgi.header(options)
+ cgi.http_header(options)
assert_equal('200 OK', req.status_line) # should be '302 Found' ?
assert_equal(302, req.status)
assert_equal('http://www.example.com/', req.headers_out['location'])