Skip to content

Commit

Permalink
We can now assume that Net::OpenTimeout is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
rzane committed Aug 7, 2022
1 parent 30795ee commit 7011493
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/webmock/http_lib_adapters/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def build_net_http_response(webmock_response, &block)
response.extend Net::WebMockHTTPResponse

if webmock_response.should_timeout
raise timeout_exception, "execution expired"
raise Net::OpenTimeout, "execution expired"
end

webmock_response.raise_error_if_any
Expand All @@ -175,16 +175,6 @@ def build_net_http_response(webmock_response, &block)
response
end

def timeout_exception
if defined?(Net::OpenTimeout)
# Ruby 2.x
Net::OpenTimeout
else
# Fallback, if things change
Timeout::Error
end
end

def build_webmock_response(net_http_response)
webmock_response = WebMock::Response.new
webmock_response.status = [
Expand Down

0 comments on commit 7011493

Please sign in to comment.