summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/rack/auth/basic.rb2
-rw-r--r--lib/rack/auth/digest/nonce.rb4
-rw-r--r--lib/rack/deflater.rb5
-rw-r--r--lib/rack/handler.rb5
-rw-r--r--lib/rack/media_type.rb2
-rw-r--r--lib/rack/multipart/parser.rb2
-rw-r--r--lib/rack/request.rb5
-rw-r--r--lib/rack/response.rb7
-rw-r--r--lib/rack/session/abstract/id.rb26
-rw-r--r--lib/rack/simple_body_proxy.rb13
-rw-r--r--lib/rack/static.rb4
-rw-r--r--lib/rack/utils.rb2
-rw-r--r--rack.gemspec9
-rw-r--r--test/builder/anything.rb7
-rw-r--r--test/helper.rb2
-rw-r--r--test/spec_auth_basic.rb2
-rw-r--r--test/spec_auth_digest.rb2
-rw-r--r--test/spec_body_proxy.rb2
-rw-r--r--test/spec_builder.rb9
-rw-r--r--test/spec_cascade.rb2
-rw-r--r--test/spec_chunked.rb2
-rw-r--r--test/spec_common_logger.rb2
-rw-r--r--test/spec_conditional_get.rb2
-rw-r--r--test/spec_config.rb2
-rw-r--r--test/spec_content_length.rb2
-rw-r--r--test/spec_content_type.rb2
-rw-r--r--test/spec_deflater.rb17
-rw-r--r--test/spec_directory.rb2
-rw-r--r--test/spec_etag.rb2
-rw-r--r--test/spec_file.rb2
-rw-r--r--test/spec_handler.rb2
-rw-r--r--test/spec_head.rb2
-rw-r--r--test/spec_lint.rb2
-rw-r--r--test/spec_lobster.rb2
-rw-r--r--test/spec_lock.rb2
-rw-r--r--test/spec_logger.rb2
-rw-r--r--test/spec_media_type.rb2
-rw-r--r--test/spec_method_override.rb2
-rw-r--r--test/spec_mime.rb2
-rw-r--r--test/spec_mock.rb2
-rw-r--r--test/spec_multipart.rb2
-rw-r--r--test/spec_null_logger.rb2
-rw-r--r--test/spec_recursive.rb2
-rw-r--r--test/spec_request.rb2
-rw-r--r--test/spec_response.rb2
-rw-r--r--test/spec_rewindable_input.rb2
-rw-r--r--test/spec_runtime.rb2
-rw-r--r--test/spec_sendfile.rb2
-rw-r--r--test/spec_server.rb4
-rw-r--r--test/spec_session_abstract_id.rb2
-rw-r--r--test/spec_session_abstract_session_hash.rb8
-rw-r--r--test/spec_session_cookie.rb2
-rw-r--r--test/spec_session_memcache.rb2
-rw-r--r--test/spec_session_pool.rb2
-rw-r--r--test/spec_show_exceptions.rb2
-rw-r--r--test/spec_show_status.rb2
-rw-r--r--test/spec_static.rb2
-rw-r--r--test/spec_tempfile_reaper.rb2
-rw-r--r--test/spec_thin.rb2
-rw-r--r--test/spec_urlmap.rb2
-rw-r--r--test/spec_utils.rb2
-rw-r--r--test/spec_version.rb2
-rw-r--r--test/spec_webrick.rb2
63 files changed, 120 insertions, 101 deletions
diff --git a/lib/rack/auth/basic.rb b/lib/rack/auth/basic.rb
index dfe2ce96..95bbafc4 100644
--- a/lib/rack/auth/basic.rb
+++ b/lib/rack/auth/basic.rb
@@ -47,7 +47,7 @@ module Rack
         end
 
         def credentials
-          @credentials ||= params.unpack("m*").first.split(/:/, 2)
+          @credentials ||= params.unpack("m*").first.split(':', 2)
         end
 
         def username
diff --git a/lib/rack/auth/digest/nonce.rb b/lib/rack/auth/digest/nonce.rb
index 6c1f28a3..089bb6f4 100644
--- a/lib/rack/auth/digest/nonce.rb
+++ b/lib/rack/auth/digest/nonce.rb
@@ -28,11 +28,11 @@ module Rack
         end
 
         def to_s
-          [([ @timestamp, digest ] * ' ')].pack("m*").strip
+          ["#{@timestamp} #{digest}"].pack("m*").strip
         end
 
         def digest
-          ::Digest::MD5.hexdigest([ @timestamp, self.class.private_key ] * ':')
+          ::Digest::MD5.hexdigest("#{@timestamp}:#{self.class.private_key}")
         end
 
         def valid?
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb
index ce248c66..939832ce 100644
--- a/lib/rack/deflater.rb
+++ b/lib/rack/deflater.rb
@@ -88,8 +88,9 @@ module Rack
         gzip = ::Zlib::GzipWriter.new(self)
         gzip.mtime = @mtime if @mtime
         @body.each { |part|
-          gzip.write(part)
-          gzip.flush if @sync
+          len = gzip.write(part)
+          # Flushing empty parts would raise Zlib::BufError.
+          gzip.flush if @sync && len > 0
         }
       ensure
         gzip.close
diff --git a/lib/rack/handler.rb b/lib/rack/handler.rb
index bc0a3bf8..024a855b 100644
--- a/lib/rack/handler.rb
+++ b/lib/rack/handler.rb
@@ -45,6 +45,9 @@ module Rack
       raise LoadError, "Couldn't find handler for: #{server_names.join(', ')}."
     end
 
+    SERVER_NAMES = %w(puma thin falcon webrick).freeze
+    private_constant :SERVER_NAMES
+
     def self.default
       # Guess.
       if ENV.include?("PHP_FCGI_CHILDREN")
@@ -54,7 +57,7 @@ module Rack
       elsif ENV.include?("RACK_HANDLER")
         self.get(ENV["RACK_HANDLER"])
       else
-        pick ['puma', 'thin', 'falcon', 'webrick']
+        pick SERVER_NAMES
       end
     end
 
diff --git a/lib/rack/media_type.rb b/lib/rack/media_type.rb
index c68df50f..41937c99 100644
--- a/lib/rack/media_type.rb
+++ b/lib/rack/media_type.rb
@@ -36,7 +36,7 @@ module Rack
       private
 
         def strip_doublequotes(str)
-          (str[0] == ?" && str[-1] == ?") ? str[1..-2] : str
+          (str.start_with?('"') && str.end_with?('"')) ? str[1..-2] : str
         end
     end
   end
diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb
index f4e8e445..7c38d5f3 100644
--- a/lib/rack/multipart/parser.rb
+++ b/lib/rack/multipart/parser.rb
@@ -352,7 +352,7 @@ module Rack
               k, v = param.split('=', 2)
               k.strip!
               v.strip!
-              v = v[1..-2] if v[0] == '"' && v[-1] == '"'
+              v = v[1..-2] if v.start_with?('"') && v.end_with?('"')
               encoding = Encoding.find v if k == CHARSET
             end
           end
diff --git a/lib/rack/request.rb b/lib/rack/request.rb
index fcdf8975..54ea86c4 100644
--- a/lib/rack/request.rb
+++ b/lib/rack/request.rb
@@ -358,7 +358,7 @@ module Rack
 
             # Fix for Safari Ajax postings that always append \0
             # form_vars.sub!(/\0\z/, '') # performance replacement:
-            form_vars.slice!(-1) if form_vars[-1] == ?\0
+            form_vars.slice!(-1) if form_vars.end_with?("\0")
 
             set_header RACK_REQUEST_FORM_VARS, form_vars
             set_header RACK_REQUEST_FORM_HASH, parse_query(form_vars, '&')
@@ -407,7 +407,8 @@ module Rack
       #
       # <tt>env['rack.input']</tt> is not touched.
       def delete_param(k)
-        [ self.POST.delete(k), self.GET.delete(k) ].compact.first
+        post_value, get_value = self.POST.delete(k), self.GET.delete(k)
+        post_value || get_value
       end
 
       def base_url
diff --git a/lib/rack/response.rb b/lib/rack/response.rb
index 2e548cde..58f9e5d6 100644
--- a/lib/rack/response.rb
+++ b/lib/rack/response.rb
@@ -3,7 +3,6 @@
 require 'rack/request'
 require 'rack/utils'
 require 'rack/body_proxy'
-require 'rack/simple_body_proxy'
 require 'rack/media_type'
 require 'time'
 
@@ -73,11 +72,7 @@ module Rack
         close
         [status.to_i, header, []]
       else
-        if @block.nil?
-          [status.to_i, header, SimpleBodyProxy.new(@body)]
-        else
-          [status.to_i, header, BodyProxy.new(self){}]
-        end
+        [status.to_i, header, BodyProxy.new(self){}]
       end
     end
     alias to_a finish           # For *response
diff --git a/lib/rack/session/abstract/id.rb b/lib/rack/session/abstract/id.rb
index c9f9f458..b15ee3b8 100644
--- a/lib/rack/session/abstract/id.rb
+++ b/lib/rack/session/abstract/id.rb
@@ -17,6 +17,26 @@ module Rack
       # SessionHash is responsible to lazily load the session from store.
 
       class SessionHash
+        using Module.new {
+          refine Hash do
+            def transform_keys(&block)
+              hash = {}
+              each do |key, value|
+                hash[block.call(key)] = value
+              end
+              hash
+            end
+          end
+        } unless {}.respond_to?(:transform_keys)
+
+        def transform_keys(&block)
+          hash = dup
+          each do |key, value|
+            hash[block.call(key)] = value
+          end
+          hash
+        end
+
         include Enumerable
         attr_writer :id
 
@@ -162,11 +182,7 @@ module Rack
         end
 
         def stringify_keys(other)
-          hash = {}
-          other.each do |key, value|
-            hash[key.to_s] = value
-          end
-          hash
+          other.transform_keys(&:to_s)
         end
       end
 
diff --git a/lib/rack/simple_body_proxy.rb b/lib/rack/simple_body_proxy.rb
deleted file mode 100644
index fe007c4c..00000000
--- a/lib/rack/simple_body_proxy.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-module Rack
-  class SimpleBodyProxy
-    def initialize(body)
-      @body = body
-    end
-
-    def each(&blk)
-      @body.each(&blk)
-    end
-  end
-end
diff --git a/lib/rack/static.rb b/lib/rack/static.rb
index 3c76a847..512e4da9 100644
--- a/lib/rack/static.rb
+++ b/lib/rack/static.rb
@@ -104,7 +104,7 @@ module Rack
     end
 
     def add_index_root?(path)
-      @index && route_file(path) && /\/$/.match?(path)
+      @index && route_file(path) && path.end_with?('/')
     end
 
     def overwrite_file_path(path)
@@ -125,7 +125,7 @@ module Rack
       if can_serve(path)
         if overwrite_file_path(path)
           env[PATH_INFO] = (add_index_root?(path) ? path + @index : @urls[path])
-        elsif @gzip && /\bgzip\b/.match?(env['HTTP_ACCEPT_ENCODING'])
+        elsif @gzip && env['HTTP_ACCEPT_ENCODING'] && /\bgzip\b/.match?(env['HTTP_ACCEPT_ENCODING'])
           path = env[PATH_INFO]
           env[PATH_INFO] += '.gz'
           response = @file_server.call(env)
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb
index 43d70a85..38d37aae 100644
--- a/lib/rack/utils.rb
+++ b/lib/rack/utils.rb
@@ -138,7 +138,7 @@ module Rack
       q_value_header.to_s.split(/\s*,\s*/).map do |part|
         value, parameters = part.split(/\s*;\s*/, 2)
         quality = 1.0
-        if md = /\Aq=([\d.]+)/.match(parameters)
+        if parameters && (md = /\Aq=([\d.]+)/.match(parameters))
           quality = md[1].to_f
         end
         [value, quality]
diff --git a/rack.gemspec b/rack.gemspec
index ba822629..f7b13b17 100644
--- a/rack.gemspec
+++ b/rack.gemspec
@@ -28,8 +28,17 @@ EOF
   s.email           = 'leah@vuxu.org'
   s.homepage        = 'https://rack.github.io/'
   s.required_ruby_version = '>= 2.2.2'
+  s.metadata              = {
+    "bug_tracker_uri"   => "https://github.com/rack/rack/issues",
+    "changelog_uri"     => "https://github.com/rack/rack/blob/master/CHANGELOG.md",
+    "documentation_uri" => "https://rubydoc.info/github/rack/rack",
+    "homepage_uri"      => "https://rack.github.io",
+    "mailing_list_uri"  => "https://groups.google.com/forum/#!forum/rack-devel",
+    "source_code_uri"   => "https://github.com/rack/rack"
+  }
 
   s.add_development_dependency 'minitest', "~> 5.0"
   s.add_development_dependency 'minitest-sprint'
+  s.add_development_dependency 'minitest-global_expectations'
   s.add_development_dependency 'rake'
 end
diff --git a/test/builder/anything.rb b/test/builder/anything.rb
deleted file mode 100644
index d8a65871..00000000
--- a/test/builder/anything.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class Anything
-  def self.call(env)
-    [200, { 'Content-Type' => 'text/plain' }, ['OK']]
-  end
-end
diff --git a/test/helper.rb b/test/helper.rb
index 9a26e6ac..dff89558 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 
 module Rack
   class TestCase < Minitest::Test
diff --git a/test/spec_auth_basic.rb b/test/spec_auth_basic.rb
index 994a79a7..3e479ace 100644
--- a/test/spec_auth_basic.rb
+++ b/test/spec_auth_basic.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/auth/basic'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_auth_digest.rb b/test/spec_auth_digest.rb
index d60417eb..cc205aa9 100644
--- a/test/spec_auth_digest.rb
+++ b/test/spec_auth_digest.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/auth/digest/md5'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_body_proxy.rb b/test/spec_body_proxy.rb
index 73b194d0..6be79f8b 100644
--- a/test/spec_body_proxy.rb
+++ b/test/spec_body_proxy.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/body_proxy'
 require 'stringio'
 
diff --git a/test/spec_builder.rb b/test/spec_builder.rb
index b1701735..853fb7b1 100644
--- a/test/spec_builder.rb
+++ b/test/spec_builder.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/builder'
 require 'rack/lint'
 require 'rack/mock'
@@ -240,13 +240,6 @@ describe Rack::Builder do
       env.must_equal({})
     end
 
-    it "requires anything not ending in .ru" do
-      $: << File.dirname(__FILE__)
-      app, * = Rack::Builder.parse_file 'builder/anything'
-      Rack::MockRequest.new(app).get("/").body.to_s.must_equal 'OK'
-      $:.pop
-    end
-
     it 'requires an_underscore_app not ending in .ru' do
       $: << File.dirname(__FILE__)
       app, * = Rack::Builder.parse_file 'builder/an_underscore_app'
diff --git a/test/spec_cascade.rb b/test/spec_cascade.rb
index 8061a254..a06aefeb 100644
--- a/test/spec_cascade.rb
+++ b/test/spec_cascade.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack'
 require 'rack/cascade'
 require 'rack/file'
diff --git a/test/spec_chunked.rb b/test/spec_chunked.rb
index 26c5c37f..daa36cad 100644
--- a/test/spec_chunked.rb
+++ b/test/spec_chunked.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/chunked'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_common_logger.rb b/test/spec_common_logger.rb
index 0aa2a048..330a6480 100644
--- a/test/spec_common_logger.rb
+++ b/test/spec_common_logger.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/common_logger'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_conditional_get.rb b/test/spec_conditional_get.rb
index a6a33df1..8402f04e 100644
--- a/test/spec_conditional_get.rb
+++ b/test/spec_conditional_get.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'time'
 require 'rack/conditional_get'
 require 'rack/mock'
diff --git a/test/spec_config.rb b/test/spec_config.rb
index d5f7ceca..d97107b6 100644
--- a/test/spec_config.rb
+++ b/test/spec_config.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/builder'
 require 'rack/config'
 require 'rack/content_length'
diff --git a/test/spec_content_length.rb b/test/spec_content_length.rb
index 8856e7d3..2e7a8581 100644
--- a/test/spec_content_length.rb
+++ b/test/spec_content_length.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/content_length'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_content_type.rb b/test/spec_content_type.rb
index a46f95ea..53f1d172 100644
--- a/test/spec_content_type.rb
+++ b/test/spec_content_type.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/content_type'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_deflater.rb b/test/spec_deflater.rb
index b0640a04..75244dcc 100644
--- a/test/spec_deflater.rb
+++ b/test/spec_deflater.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'time'  # for Time#httpdate
 require 'rack/deflater'
@@ -114,6 +114,19 @@ describe Rack::Deflater do
     end
   end
 
+  it 'be able to deflate bodies that respond to each and contain empty chunks' do
+    app_body = Object.new
+    class << app_body; def each; yield('foo'); yield(''); yield('bar'); end; end
+
+    verify(200, 'foobar', deflate_or_gzip, { 'app_body' => app_body }) do |status, headers, body|
+      headers.must_equal({
+        'Content-Encoding' => 'gzip',
+        'Vary' => 'Accept-Encoding',
+        'Content-Type' => 'text/plain'
+      })
+    end
+  end
+
   it 'flush deflated chunks to the client as they become ready' do
     app_body = Object.new
     class << app_body; def each; yield('foo'); yield('bar'); end; end
@@ -388,7 +401,7 @@ describe Rack::Deflater do
     app_body = Object.new
     class << app_body
       def each
-        (0..20).each { |i| yield "hello\n".freeze }
+        (0..20).each { |i| yield "hello\n" }
       end
     end
 
diff --git a/test/spec_directory.rb b/test/spec_directory.rb
index 1187471c..8635ec90 100644
--- a/test/spec_directory.rb
+++ b/test/spec_directory.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/directory'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_etag.rb b/test/spec_etag.rb
index 5e13d538..750ceaac 100644
--- a/test/spec_etag.rb
+++ b/test/spec_etag.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/etag'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_file.rb b/test/spec_file.rb
index 55b6eaad..ba713c61 100644
--- a/test/spec_file.rb
+++ b/test/spec_file.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/file'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_handler.rb b/test/spec_handler.rb
index c38cf4e9..5746dc22 100644
--- a/test/spec_handler.rb
+++ b/test/spec_handler.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/handler'
 
 class Rack::Handler::Lobster; end
diff --git a/test/spec_head.rb b/test/spec_head.rb
index 1cf8b391..f6f41a5d 100644
--- a/test/spec_head.rb
+++ b/test/spec_head.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/head'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_lint.rb b/test/spec_lint.rb
index 07f7fe2b..192f260f 100644
--- a/test/spec_lint.rb
+++ b/test/spec_lint.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'tempfile'
 require 'rack/lint'
diff --git a/test/spec_lobster.rb b/test/spec_lobster.rb
index d4fcff47..9f3b9a89 100644
--- a/test/spec_lobster.rb
+++ b/test/spec_lobster.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/lobster'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_lock.rb b/test/spec_lock.rb
index 25d71fc6..cd9e1230 100644
--- a/test/spec_lock.rb
+++ b/test/spec_lock.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/lint'
 require 'rack/lock'
 require 'rack/mock'
diff --git a/test/spec_logger.rb b/test/spec_logger.rb
index d6876c5f..f453b14d 100644
--- a/test/spec_logger.rb
+++ b/test/spec_logger.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'rack/lint'
 require 'rack/logger'
diff --git a/test/spec_media_type.rb b/test/spec_media_type.rb
index 580d24ce..7d52b4d4 100644
--- a/test/spec_media_type.rb
+++ b/test/spec_media_type.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/media_type'
 
 describe Rack::MediaType do
diff --git a/test/spec_method_override.rb b/test/spec_method_override.rb
index 00990f9b..6b01f7c9 100644
--- a/test/spec_method_override.rb
+++ b/test/spec_method_override.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'rack/method_override'
 require 'rack/mock'
diff --git a/test/spec_mime.rb b/test/spec_mime.rb
index b9258eb6..8d1ca256 100644
--- a/test/spec_mime.rb
+++ b/test/spec_mime.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/mime'
 
 describe Rack::Mime do
diff --git a/test/spec_mock.rb b/test/spec_mock.rb
index 4c5e1b7c..d7246d3f 100644
--- a/test/spec_mock.rb
+++ b/test/spec_mock.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'yaml'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_multipart.rb b/test/spec_multipart.rb
index 67888dc0..b029048e 100644
--- a/test/spec_multipart.rb
+++ b/test/spec_multipart.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack'
 require 'rack/multipart'
 require 'rack/multipart/parser'
diff --git a/test/spec_null_logger.rb b/test/spec_null_logger.rb
index f15d47a9..1037c9fa 100644
--- a/test/spec_null_logger.rb
+++ b/test/spec_null_logger.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/lint'
 require 'rack/mock'
 require 'rack/null_logger'
diff --git a/test/spec_recursive.rb b/test/spec_recursive.rb
index be1e97e6..e77d966d 100644
--- a/test/spec_recursive.rb
+++ b/test/spec_recursive.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/lint'
 require 'rack/recursive'
 require 'rack/mock'
diff --git a/test/spec_request.rb b/test/spec_request.rb
index 4dd30707..583a367e 100644
--- a/test/spec_request.rb
+++ b/test/spec_request.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'cgi'
 require 'rack/request'
diff --git a/test/spec_response.rb b/test/spec_response.rb
index 68c0953c..3cd56664 100644
--- a/test/spec_response.rb
+++ b/test/spec_response.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack'
 require 'rack/response'
 require 'stringio'
diff --git a/test/spec_rewindable_input.rb b/test/spec_rewindable_input.rb
index 932e9de3..6bb5f5cf 100644
--- a/test/spec_rewindable_input.rb
+++ b/test/spec_rewindable_input.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'stringio'
 require 'rack/rewindable_input'
 
diff --git a/test/spec_runtime.rb b/test/spec_runtime.rb
index 5a7e84bd..10e561de 100644
--- a/test/spec_runtime.rb
+++ b/test/spec_runtime.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/lint'
 require 'rack/mock'
 require 'rack/runtime'
diff --git a/test/spec_sendfile.rb b/test/spec_sendfile.rb
index 8688df9f..cbed8db3 100644
--- a/test/spec_sendfile.rb
+++ b/test/spec_sendfile.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'fileutils'
 require 'rack/lint'
 require 'rack/sendfile'
diff --git a/test/spec_server.rb b/test/spec_server.rb
index 7a60a61e..b09caf03 100644
--- a/test/spec_server.rb
+++ b/test/spec_server.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack'
 require 'rack/server'
 require 'tempfile'
@@ -161,6 +161,8 @@ describe Rack::Server do
   end
 
   it "check pid file presence and not owned process" do
+    owns_pid_1 = (Process.kill(0, 1) rescue nil) == 1
+    skip "cannot test if pid 1 owner matches current process (eg. docker/lxc)" if owns_pid_1
     pidfile = Tempfile.open('pidfile') { |f| f.write(1); break f }.path
     server = Rack::Server.new(pid: pidfile)
     server.send(:pidfile_process_status).must_equal :not_owned
diff --git a/test/spec_session_abstract_id.rb b/test/spec_session_abstract_id.rb
index 00140c16..3591a3de 100644
--- a/test/spec_session_abstract_id.rb
+++ b/test/spec_session_abstract_id.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 ### WARNING: there be hax in this file.
 
 require 'rack/session/abstract/id'
diff --git a/test/spec_session_abstract_session_hash.rb b/test/spec_session_abstract_session_hash.rb
index 37030a8c..5d0d10ce 100644
--- a/test/spec_session_abstract_session_hash.rb
+++ b/test/spec_session_abstract_session_hash.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/session/abstract/id'
 
 describe Rack::Session::Abstract::SessionHash do
@@ -44,4 +44,10 @@ describe Rack::Session::Abstract::SessionHash do
       lambda { hash.fetch(:unknown) }.must_raise KeyError
     end
   end
+
+  describe "#stringify_keys" do
+    it "returns hash or session hash with keys stringified" do
+      assert_equal({ "foo" => :bar, "baz" => :qux }, hash.send(:stringify_keys, hash).to_h)
+    end
+  end
 end
diff --git a/test/spec_session_cookie.rb b/test/spec_session_cookie.rb
index 8ecfde53..9b4442dd 100644
--- a/test/spec_session_cookie.rb
+++ b/test/spec_session_cookie.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/session/cookie'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_session_memcache.rb b/test/spec_session_memcache.rb
index da90b340..a015cee6 100644
--- a/test/spec_session_memcache.rb
+++ b/test/spec_session_memcache.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 begin
   require 'rack/session/memcache'
   require 'rack/lint'
diff --git a/test/spec_session_pool.rb b/test/spec_session_pool.rb
index 6eecce36..fda5f56e 100644
--- a/test/spec_session_pool.rb
+++ b/test/spec_session_pool.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'thread'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_show_exceptions.rb b/test/spec_show_exceptions.rb
index 9cad32ce..a4ade121 100644
--- a/test/spec_show_exceptions.rb
+++ b/test/spec_show_exceptions.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/show_exceptions'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_show_status.rb b/test/spec_show_status.rb
index a4b58e2a..ca23134e 100644
--- a/test/spec_show_status.rb
+++ b/test/spec_show_status.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/show_status'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_static.rb b/test/spec_static.rb
index 7c510bf6..d33e8edc 100644
--- a/test/spec_static.rb
+++ b/test/spec_static.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/static'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_tempfile_reaper.rb b/test/spec_tempfile_reaper.rb
index f6b79641..0e7de841 100644
--- a/test/spec_tempfile_reaper.rb
+++ b/test/spec_tempfile_reaper.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/tempfile_reaper'
 require 'rack/lint'
 require 'rack/mock'
diff --git a/test/spec_thin.rb b/test/spec_thin.rb
index cc4967b2..0729c3f3 100644
--- a/test/spec_thin.rb
+++ b/test/spec_thin.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 begin
 require 'rack/handler/thin'
 require File.expand_path('../testrequest', __FILE__)
diff --git a/test/spec_urlmap.rb b/test/spec_urlmap.rb
index f5d7e115..9ce38298 100644
--- a/test/spec_urlmap.rb
+++ b/test/spec_urlmap.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/urlmap'
 require 'rack/mock'
 
diff --git a/test/spec_utils.rb b/test/spec_utils.rb
index 2089ee2c..6210fd73 100644
--- a/test/spec_utils.rb
+++ b/test/spec_utils.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/utils'
 require 'rack/mock'
 require 'timeout'
diff --git a/test/spec_version.rb b/test/spec_version.rb
index 04604ebf..d4191aa4 100644
--- a/test/spec_version.rb
+++ b/test/spec_version.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack'
 
 describe Rack do
diff --git a/test/spec_webrick.rb b/test/spec_webrick.rb
index cabb2e4a..0d0aa8f7 100644
--- a/test/spec_webrick.rb
+++ b/test/spec_webrick.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'minitest/autorun'
+require 'minitest/global_expectations/autorun'
 require 'rack/mock'
 require 'thread'
 require File.expand_path('../testrequest', __FILE__)