Sha256: ac18c9e1fb5c56dfd2fa2c2aabbc43ffbe5377a6857cd70839f031839add1597

Contents?: true

Size: 374 Bytes

Versions: 131

Compression:

Stored size: 374 Bytes

Contents

require 'timeout'
require 'socket'

TCPSocket.class_eval do
  def self.wait_for_service(options)
    Timeout::timeout(options[:timeout] || 20) do
      loop do
        begin
          socket = TCPSocket.new(options[:host], options[:port])
          socket.close
          return
        rescue Errno::ECONNREFUSED
          sleep 0.5
        end
      end
    end
  end
end

Version data entries

131 entries across 131 versions & 1 rubygems

Version Path
braintree-2.48.0 spec/hacks/tcp_socket.rb
braintree-2.47.0 spec/hacks/tcp_socket.rb
braintree-2.46.0 spec/hacks/tcp_socket.rb
braintree-2.45.0 spec/hacks/tcp_socket.rb
braintree-2.44.0 spec/hacks/tcp_socket.rb
braintree-2.43.0 spec/hacks/tcp_socket.rb
braintree-2.42.0 spec/hacks/tcp_socket.rb
braintree-2.41.0 spec/hacks/tcp_socket.rb
braintree-2.40.0 spec/hacks/tcp_socket.rb
braintree-2.39.0 spec/hacks/tcp_socket.rb
braintree-2.38.0 spec/hacks/tcp_socket.rb
braintree-2.37.0 spec/hacks/tcp_socket.rb
braintree-2.36.0 spec/hacks/tcp_socket.rb
braintree-2.35.0 spec/hacks/tcp_socket.rb
braintree-2.34.1 spec/hacks/tcp_socket.rb
braintree-2.34.0 spec/hacks/tcp_socket.rb
braintree-2.33.1 spec/hacks/tcp_socket.rb
braintree-2.33.0 spec/hacks/tcp_socket.rb
braintree-2.32.1 spec/hacks/tcp_socket.rb
braintree-2.31.0 spec/hacks/tcp_socket.rb