tests: make timeout tests reliable under 1.9
[rainbows.git] / t / async-response-no-autochunk.ru
blob67c6403039653c95313686b37244cdcbc7d0abed
1 use Rack::Chunked
2 use Rainbows::DevFdResponse
3 script = <<-EOF
4 for i in 0 1 2 3 4 5 6 7 8 9
5 do
6         printf '1\r\n%s\r\n' $i
7         sleep 1
8 done
9 printf '0\r\n\r\n'
10 EOF
12 run lambda { |env|
13   env['rainbows.autochunk'] = false
14   io = IO.popen(script, 'rb')
15   io.sync = true
16   [
17     200,
18     {
19       'Content-Type' => 'text/plain',
20       'Transfer-Encoding' => 'chunked',
21     },
22     io
23   ].freeze