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.68.1 spec/hacks/tcp_socket.rb
braintree-2.68.0 spec/hacks/tcp_socket.rb
braintree-2.67.0 spec/hacks/tcp_socket.rb
braintree-2.66.0 spec/hacks/tcp_socket.rb
braintree-2.65.0 spec/hacks/tcp_socket.rb
braintree-2.64.0 spec/hacks/tcp_socket.rb
braintree-2.63.0 spec/hacks/tcp_socket.rb
braintree-2.62.0 spec/hacks/tcp_socket.rb
braintree-2.61.1 spec/hacks/tcp_socket.rb
braintree-2.61.0 spec/hacks/tcp_socket.rb
braintree-2.60.0 spec/hacks/tcp_socket.rb
braintree-2.59.0 spec/hacks/tcp_socket.rb
braintree-2.58.0 spec/hacks/tcp_socket.rb
braintree-2.57.0 spec/hacks/tcp_socket.rb
braintree-2.56.0 spec/hacks/tcp_socket.rb
braintree-2.55.0 spec/hacks/tcp_socket.rb
braintree-2.54.0 spec/hacks/tcp_socket.rb
braintree-2.50.0 spec/hacks/tcp_socket.rb
braintree-2.49.0 spec/hacks/tcp_socket.rb
braintree-2.48.1 spec/hacks/tcp_socket.rb