Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Check if request timedout is compatible with latest Typhoeus versions.

  • Loading branch information...
commit 1850e8b4590e4f35ebd101d6a196318aaaf67c87 1 parent ca7d5e2
@bblimke authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
View
10 spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
@@ -1,7 +1,8 @@
require 'ostruct'
module TyphoeusHydraSpecHelper
- class FakeTyphoeusHydraError < StandardError; end
+ class FakeTyphoeusHydraTimeoutError < StandardError; end
+ class FakeTyphoeusHydraConnectError < StandardError; end
def http_request(method, uri, options = {}, &block)
@@ -14,7 +15,8 @@ def http_request(method, uri, options = {}, &block)
:timeout => 25000 # milliseconds
}
)
- raise FakeTyphoeusHydraError.new if response.code.to_s == "0"
+ raise FakeTyphoeusHydraTimeoutError.new if response.timed_out?
+ raise FakeTyphoeusHydraConnectError.new if response.code == 0
OpenStruct.new({
:body => response.body,
:headers => WebMock::Util::Headers.normalize_headers(join_array_values(response.headers_hash)),
@@ -36,11 +38,11 @@ def join_array_values(hash)
def client_timeout_exception_class
- FakeTyphoeusHydraError
+ FakeTyphoeusHydraTimeoutError
end
def connection_refused_exception_class
- FakeTyphoeusHydraError
+ FakeTyphoeusHydraConnectError
end
def http_library
Please sign in to comment.
Something went wrong with that request. Please try again.