blob: 563c592b549335a08a68c13681ca1279d2bf08f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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
|