rack.git  about / heads / tags
a modular Ruby webserver interface
blob aa9c0e0af0727fde531852b659646ed01d75f70c 984 bytes (raw)
$ git show rfc7231-sec6.3.6-205:test/helper.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
require 'minitest/autorun'

module Rack
  class TestCase < Minitest::Test
    # Check for Lighttpd and launch it for tests if available.
    `which lighttpd`

    if $?.success?
      begin
        # Keep this first.
        LIGHTTPD_PID = fork {
          ENV['RACK_ENV'] = 'deployment'
          ENV['RUBYLIB'] = [
            ::File.expand_path('../../lib', __FILE__),
            ENV['RUBYLIB'],
          ].compact.join(':')

          Dir.chdir(::File.expand_path("../cgi", __FILE__)) do
            exec "lighttpd -D -f lighttpd.conf"
          end
        }
      rescue NotImplementedError
        warn "Your Ruby doesn't support Kernel#fork. Skipping Rack::Handler::CGI and ::FastCGI tests."
      else
        Minitest.after_run do
          Process.kill 15, LIGHTTPD_PID
          Process.wait LIGHTTPD_PID
        end
      end
    else
      warn "Lighttpd isn't installed. Skipping Rack::Handler::CGI and FastCGI tests. Install lighttpd to run them."
    end
  end
end

git clone https://yhbt.net/rack.git