Sha256: 8666f7ef886cedf5924022b00e34f50c9d63c97c40a596f5399701d28cd0b275

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require "randomized"
require "socket"
require "rspec/stress_it"

RSpec.configure do |c|
  c.extend RSpec::StressIt
end

describe TCPServer do
  subject(:socket) { Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) }
  let(:sockaddr) { Socket.sockaddr_in(port, "127.0.0.1") }
  after { socket.close }

  context "on a random port" do
    let(:port) { Randomized.number(-100000..100000) }
    analyze_it "should bind successfully", [:port] do
      socket.bind(sockaddr)
      expect(socket.local_address.ip_port).to(be == port)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flores-0.0.1 examples/socket_analyze_spec.rb