We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e583c0 commit cadef36Copy full SHA for cadef36
1 file changed
lib/webmock/http_lib_adapters/net_http.rb
@@ -128,7 +128,11 @@ def start_without_connect
128
129
130
def ensure_actual_connection
131
- do_start if @socket.is_a?(StubSocket)
+ if @socket.is_a?(StubSocket)
132
+ @socket&.close
133
+ @socket = nil
134
+ do_start
135
+ end
136
end
137
138
alias_method :start_with_connect, :start
@@ -232,13 +236,16 @@ class StubSocket #:nodoc:
232
236
attr_accessor :read_timeout, :continue_timeout, :write_timeout
233
237
234
238
def initialize(*args)
239
+ @closed = false
235
240
241
242
def closed?
- @closed ||= true
243
+ @closed
244
245
246
def close
247
+ @closed = true
248
+ nil
249
250
251
def readuntil(*args)
0 commit comments