Sha256: c019acc3ac8056762e99ca0a019cb37ef19069f6e181ce500abe69409a8133c4

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

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

describe "Socket#getservbyname" do
  it "returns the port for service 'http'" do
    Socket.getservbyname('http').should == 80
  end

  it "returns the port for service 'http' with protocol 'tcp'" do
    Socket.getservbyname('http', 'tcp').should == 80
  end

  it "returns the port for service 'domain' with protocol 'udp'" do
    Socket.getservbyname('domain', 'udp').should == 53
  end

  it "returns the port for service 'daytime'" do
    Socket.getservbyname('daytime').should == 13
  end

  it "raises a SocketError when the service or port is invalid" do
    lambda { Socket.getservbyname('invalid') }.should raise_error(SocketError)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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