/
helper.rb
31 lines (29 loc) · 920 Bytes
/
helper.rb
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
require 'minitest/autorun'
module Rack
class TestCase < Minitest::Test
if `which lighttpd` && !$?.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