Browse files

Another try with Typhoeus on Travis

  • Loading branch information...
1 parent 14f1b94 commit 917241c182505edb544e012b2804bbc99abcfe4a @bblimke committed Mar 17, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
View
11 spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
@@ -7,7 +7,7 @@ class FakeTyphoeusHydraConnectError < StandardError; end
def http_request(method, uri, options = {}, &block)
uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
- response = Typhoeus::Request.run(uri,
+ request = Typhoeus::Request.new(uri,
{
:method => method,
:body => options[:body],
@@ -16,11 +16,12 @@ def http_request(method, uri, options = {}, &block)
:verbose => true
}
)
+ hydra = Typhoeus::Hydra.new(:initial_pool_size => 0)
+ hydra.queue(request)
+ hydra.run
+ response = request.response
raise FakeTyphoeusHydraTimeoutError.new if response.timed_out?
- if response.code == 0
- p response
- raise FakeTyphoeusHydraConnectError.new
- end
+ raise FakeTyphoeusHydraConnectError.new if response.code == 0
OpenStruct.new({
:body => response.body,
:headers => WebMock::Util::Headers.normalize_headers(join_array_values(response.headers_hash)),

0 comments on commit 917241c

Please sign in to comment.