Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test for @22005b9

  • Loading branch information...
commit d4a94c37bcd27e17d8041a051436a1e9ec2100e7 1 parent c70da58
@drbrain authored
Showing with 25 additions and 2 deletions.
  1. +2 −2 History.txt
  2. +23 −0 test/test_net_http_pipeline.rb
View
4 History.txt
@@ -1,8 +1,8 @@
=== 1.0.1 / 2012-04-13
* Bug fixes
- * IOError is now handled in pipeline_check in case you pipeline to a closed
- socket.
+ * IOError is now handled in pipeline_check and pipeline_receive in case you
+ pipeline to a closed socket. Partial patch by Eric Wong. Issue #2
=== 1.0 / 2011-03-29
View
23 test/test_net_http_pipeline.rb
@@ -625,6 +625,29 @@ def test_pipeline_receive_bad_response
assert_kind_of Errno::ECONNRESET, e.original
end
+ def test_pipeline_receive_ioerror
+ @socket = Buffer.new IOError
+ @socket.read_io.write http_response('Worked 1!')
+ @socket.start
+
+ in_flight = [@get1, @get2]
+ responses = []
+
+ e = assert_raises Net::HTTP::Pipeline::ResponseError do
+ pipeline_receive in_flight, responses
+ end
+
+ @socket.finish
+
+ assert @socket.closed?
+
+ assert_equal [@get2], e.requests
+ assert_equal 1, e.responses.length
+ assert_equal 'Worked 1!', e.responses.first.body
+
+ assert_kind_of IOError, e.original
+ end
+
def test_pipeline_receive_timeout
@socket = Buffer.new Timeout::Error
@socket.read_io.write http_response('Worked 1!')
Please sign in to comment.
Something went wrong with that request. Please try again.