Skip to content

Commit

Permalink
Add windows guards for nonblock sockets specs
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Feb 5, 2024
1 parent aaf88ea commit 3fc4444
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions library/socket/tcpserver/accept_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@
@socket.should be_an_instance_of(TCPSocket)
end

it "returns a TCPSocket which is set to nonblocking" do
require 'io/nonblock'
@socket = @server.accept
@socket.should.nonblock?
platform_is_not :windows do
it "returns a TCPSocket which is set to nonblocking" do
require 'io/nonblock'
@socket = @server.accept
@socket.should.nonblock?
end
end

it "returns a TCPSocket which is set to close on exec" do
Expand Down
10 changes: 6 additions & 4 deletions library/socket/tcpsocket/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@
@client.remote_address.ip_port.should == @server.local_address.ip_port
end

it "creates a socket which is set to nonblocking" do
require 'io/nonblock'
@client = TCPSocket.new(ip_address, @port)
@client.should.nonblock?
platform_is_not :windows do
it "creates a socket which is set to nonblocking" do
require 'io/nonblock'
@client = TCPSocket.new(ip_address, @port)
@client.should.nonblock?
end
end

it "creates a socket which is set to close on exec" do
Expand Down
10 changes: 6 additions & 4 deletions library/socket/udpsocket/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
@socket.binmode?.should be_true
end

it 'sets the socket to nonblock' do
require 'io/nonblock'
@socket = UDPSocket.new(:INET)
@socket.should.nonblock?
platform_is_not :windows do
it 'sets the socket to nonblock' do
require 'io/nonblock'
@socket = UDPSocket.new(:INET)
@socket.should.nonblock?
end
end

it 'sets the socket to close on exec' do
Expand Down

0 comments on commit 3fc4444

Please sign in to comment.