Sha256: ae5d2c0795835d7eaeb4dcbe21554c743e719ca1e2b23cacd35e943c2c6de5d4

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

require File.expand_path('../../fixtures/classes', __FILE__)

describe "TCPSocket#recv_nonblock" do
  before :all do
    SocketSpecs::SpecTCPServer.start
  end

  before :each do
    @hostname = SocketSpecs::SpecTCPServer.get.hostname
    @socket = nil
  end

  after :each do
    if @socket
      @socket.write "QUIT"
      @socket.close
    end
  end

  it "returns a String read from the socket" do
    @socket = TCPSocket.new @hostname, SocketSpecs.port
    @socket.write "TCPSocket#recv_nonblock"

    # Wait for the server to echo. This spec is testing the return
    # value, not the non-blocking behavior.
    #
    # TODO: Figure out a good way to test non-blocking.
    IO.select([@socket])
    @socket.recv_nonblock(50).should == "TCPSocket#recv_nonblock"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysl-socket-1.0.1 spec/tcpsocket/recv_nonblock_spec.rb
rubysl-socket-2.0.1 spec/tcpsocket/recv_nonblock_spec.rb
rubysl-socket-1.0.0 spec/tcpsocket/recv_nonblock_spec.rb
rubysl-socket-2.0.0 spec/tcpsocket/recv_nonblock_spec.rb