Skip to content

Commit

Permalink
Merge pull request #790 from mame/master
Browse files Browse the repository at this point in the history
Use `super` instead of copy-and-paste in `Net::WebMockNetBufferedIO#i…
  • Loading branch information
bblimke authored Dec 27, 2018
2 parents ddf3191 + f2a9ab3 commit 0bb025d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/webmock/http_lib_adapters/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,18 @@ def readuntil(*args)
module Net #:nodoc: all

class WebMockNetBufferedIO < BufferedIO
def initialize(io, read_timeout: 60, write_timeout: 60, continue_timeout: nil, debug_output: nil)
@read_timeout = read_timeout
@write_timeout = write_timeout
@rbuf = ''.dup
@debug_output = debug_output

@io = case io
def initialize(io, **)
io = case io
when Socket, OpenSSL::SSL::SSLSocket, IO
io
when StringIO
PatchedStringIO.new(io.string)
when String
PatchedStringIO.new(io)
end
raise "Unable to create local socket" unless @io
raise "Unable to create local socket" unless io

super
end

if RUBY_VERSION >= '2.6.0'
Expand Down

0 comments on commit 0bb025d

Please sign in to comment.