Browse files

Test added

  • Loading branch information...
1 parent 56848e4 commit 1f540a17140078594454c54b66c582a3ca182bf1 George committed Sep 25, 2013
Showing with 18 additions and 1 deletion.
  1. +12 −0 test/integration/app.rb
  2. +6 −1 test/integration_test.rb
View
12 test/integration/app.rb
@@ -49,6 +49,18 @@
send_file file
end
+get '/streaming' do
+ headers['Content-Length'] = '46'
+ stream do |out|
+ out << "It's gonna be legen -\n"
+ sleep 0.5
+ out << " (wait for it) \n"
+ puts headers
+ sleep 1
+ out << "- dary!\n"
+ end
+end
+
class Subclass < Sinatra::Base
set :out, nil
get '/subclass/async' do
View
7 test/integration_test.rb
@@ -96,4 +96,9 @@ class IntegrationTest < Test::Unit::TestCase
response = server.get_response '/send_file'
assert response['Content-Length']
end
-end
+
+ it "doesn't ignore Content-Length header when streaming" do
+ response = server.get_response '/streaming'
+ assert response['Content-Length'], '46'

This should read:

assert_equal '46', response['Content-Length']

or just

assert response['Content-Length']

Yeah, sure, I’ll fix that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+end

0 comments on commit 1f540a1

Please sign in to comment.