1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/library/socket/socket/getservbyport_spec.rb
2019-07-27 12:40:09 +02:00

23 lines
617 B
Ruby

require_relative '../spec_helper'
describe 'Socket.getservbyport' do
platform_is_not :windows do
it 'returns the service name as a String' do
Socket.getservbyport(514).should == 'shell'
end
end
platform_is :windows do
it 'returns the service name as a String' do
Socket.getservbyport(514).should == 'cmd'
end
end
it 'returns the service name when using a custom protocol name' do
Socket.getservbyport(514, 'udp').should == 'syslog'
end
it 'raises SocketError for an unknown port number' do
-> { Socket.getservbyport(0) }.should raise_error(SocketError)
end
end