Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated the tests to use net/http since open-uri doesn't stream respo…

…nses.

Oh, and now the tests actually pass.
  • Loading branch information...
commit 320c9469a6766bdcc1e22aef65941ca0fb901411 1 parent ff7ebd5
@technomancy technomancy authored
Showing with 13 additions and 4 deletions.
  1. +12 −3 test/spec_rack_mongrel.rb
  2. +1 −1  test/testrequest.rb
View
15 test/spec_rack_mongrel.rb
@@ -6,7 +6,6 @@
require 'rack/lint'
require 'testrequest'
require 'timeout'
-require 'open-uri'
Thread.abort_on_exception = true
$tcp_defer_accept_opts = nil
@@ -165,9 +164,19 @@
end
specify "should stream #each part of the response" do
- Timeout.timeout(1) do
- open("http://#{@host}:#{@port}/stream").gets
+ body = ''
+ begin
+ Timeout.timeout(1) do
+ Net::HTTP.start(@host, @port) do |http|
+ get = Net::HTTP::Get.new('/stream')
+ http.request(get) do |response|
+ response.read_body { |part| body << part }
+ end
+ end
+ end
+ rescue Timeout::Error
end
+ body.should.not.be.empty
end
teardown do
View
2  test/testrequest.rb
@@ -51,7 +51,7 @@ def self.call(env)
def each
yield "hello there!\n"
- sleep 2
+ sleep 5
yield "that is all.\n"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.