|
54 | 54 | buffer.encoding.should == Encoding::ISO_8859_1 |
55 | 55 | end |
56 | 56 |
|
57 | | - it "uses different message options" do |
58 | | - @client.send("foobar", Socket::MSG_PEEK) |
59 | | - sock = @server.accept |
60 | | - peek_data = sock.recvfrom(6, Socket::MSG_PEEK) # Does not retrieve the message |
61 | | - real_data = sock.recvfrom(6) |
62 | | - |
63 | | - real_data.should == peek_data |
64 | | - peek_data.should == ["foobar", ["AF_UNIX", ""]] |
65 | | - sock.close |
| 57 | + platform_is_not :windows do |
| 58 | + it "uses different message options" do |
| 59 | + @client.send("foobar", Socket::MSG_PEEK) |
| 60 | + sock = @server.accept |
| 61 | + peek_data = sock.recvfrom(6, Socket::MSG_PEEK) # Does not retrieve the message |
| 62 | + real_data = sock.recvfrom(6) |
| 63 | + |
| 64 | + real_data.should == peek_data |
| 65 | + peek_data.should == ["foobar", ["AF_UNIX", ""]] |
| 66 | + sock.close |
| 67 | + end |
66 | 68 | end |
67 | 69 | end |
68 | 70 |
|
|
83 | 85 | end |
84 | 86 | end |
85 | 87 |
|
86 | | - # These specs are taken from the rdoc examples on UNIXSocket#recvfrom. |
87 | | - describe 'using a UNIX socket constructed using UNIXSocket.for_fd' do |
88 | | - before do |
89 | | - @path1 = SocketSpecs.socket_path |
90 | | - @path2 = SocketSpecs.socket_path.chop + '2' |
91 | | - rm_r(@path2) |
| 88 | + platform_is_not :windows do |
| 89 | + # These specs are taken from the rdoc examples on UNIXSocket#recvfrom. |
| 90 | + describe 'using a UNIX socket constructed using UNIXSocket.for_fd' do |
| 91 | + before do |
| 92 | + @path1 = SocketSpecs.socket_path |
| 93 | + @path2 = SocketSpecs.socket_path.chop + '2' |
| 94 | + rm_r(@path2) |
92 | 95 |
|
93 | | - @client_raw = Socket.new(:UNIX, :DGRAM) |
94 | | - @client_raw.bind(Socket.sockaddr_un(@path1)) |
| 96 | + @client_raw = Socket.new(:UNIX, :DGRAM) |
| 97 | + @client_raw.bind(Socket.sockaddr_un(@path1)) |
95 | 98 |
|
96 | | - @server_raw = Socket.new(:UNIX, :DGRAM) |
97 | | - @server_raw.bind(Socket.sockaddr_un(@path2)) |
| 99 | + @server_raw = Socket.new(:UNIX, :DGRAM) |
| 100 | + @server_raw.bind(Socket.sockaddr_un(@path2)) |
98 | 101 |
|
99 | | - @socket = UNIXSocket.for_fd(@server_raw.fileno) |
100 | | - @socket.autoclose = false |
101 | | - end |
| 102 | + @socket = UNIXSocket.for_fd(@server_raw.fileno) |
| 103 | + @socket.autoclose = false |
| 104 | + end |
102 | 105 |
|
103 | | - after do |
104 | | - @client_raw.close |
105 | | - @server_raw.close # also closes @socket |
| 106 | + after do |
| 107 | + @client_raw.close |
| 108 | + @server_raw.close # also closes @socket |
106 | 109 |
|
107 | | - rm_r @path1 |
108 | | - rm_r @path2 |
109 | | - end |
| 110 | + rm_r @path1 |
| 111 | + rm_r @path2 |
| 112 | + end |
110 | 113 |
|
111 | | - it 'returns an Array containing the data and address information' do |
112 | | - @client_raw.send('hello', 0, Socket.sockaddr_un(@path2)) |
| 114 | + it 'returns an Array containing the data and address information' do |
| 115 | + @client_raw.send('hello', 0, Socket.sockaddr_un(@path2)) |
113 | 116 |
|
114 | | - @socket.recvfrom(5).should == ['hello', ['AF_UNIX', @path1]] |
| 117 | + @socket.recvfrom(5).should == ['hello', ['AF_UNIX', @path1]] |
| 118 | + end |
115 | 119 | end |
116 | 120 | end |
117 | 121 | end |
|
0 commit comments