Sha256: aa40f71c272acc6a0f17a21ded9a09a0b1e440ed8cd7179536b63f0e8f904d8a
Contents?: true
Size: 906 Bytes
Versions: 10
Compression:
Stored size: 906 Bytes
Contents
require 'jellyfish/test' # stolen from sinatra describe 'Sinatra streaming_test.rb' do paste :jellyfish would 'return the concatinated body' do app = Class.new{ include Jellyfish get '/' do Jellyfish::ChunkedBody.new{ |out| out['Hello'] out[' '] out['World!'] } end }.new _, _, body = get('/', app) body.to_a.join.should.eq 'Hello World!' end would 'postpone body generation' do stream = Jellyfish::ChunkedBody.new{ |out| 10.times{ |i| out[i] } } stream.each.with_index do |s, i| s.should.eq i end end would 'give access to route specific params' do app = Class.new{ include Jellyfish get(%r{/(?<name>\w+)}){ |m| Jellyfish::ChunkedBody.new{ |o| o[m[:name]] } } }.new _, _, body = get('/foo', app) body.to_a.join.should.eq 'foo' end end
Version data entries
10 entries across 10 versions & 1 rubygems