tests: fix issues with non-portable shell constructs
[rainbows.git] / t / sleep.ru
blob9e4eff1d1c29bf8c70ddf3dd12fec369896c2590
1 use Rack::ContentLength
3 run lambda { |env|
4   /\A100-continue\z/i =~ env['HTTP_EXPECT'] and return [ 100, {}, [] ]
6   env['rack.input'].read
7   nr = 1
8   env["PATH_INFO"] =~ %r{/([\d\.]+)\z} and nr = $1.to_f
10   (case env['rainbows.model']
11   when :Revactor
12     Actor
13   else
14     Kernel
15   end).sleep(nr)
17   [ 200, {'Content-Type' => 'text/plain'}, [ "Hello\n" ] ]