Skip to content

Commit 64926d5

Browse files
MSP-Greghsbt
authored andcommitted
test/net/smtp - use TCPSocket when UNIXSocket unavailable
1 parent 2ef3b97 commit 64926d5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/net/smtp/test_sslcontext.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def teardown
3939
end
4040

4141
def start_smtpd(starttls)
42-
@server_socket, @client_socket = UNIXSocket.pair
42+
@server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
43+
UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
4344
@starttls_executed = false
4445
@server_thread = Thread.new(@server_socket) do |s|
4546
s.puts "220 fakeserver\r\n"
@@ -125,4 +126,4 @@ def test_start_without_tls_hostname
125126
end
126127

127128
end
128-
end unless /mswin|mingw/ =~ RUBY_PLATFORM
129+
end

test/net/smtp/test_starttls.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def teardown
2525
end
2626

2727
def start_smtpd(starttls)
28-
@server_socket, @client_socket = UNIXSocket.pair
28+
@server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
29+
UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
2930
@starttls_executed = false
3031
@server_thread = Thread.new(@server_socket) do |s|
3132
s.puts "220 fakeserver\r\n"
@@ -118,4 +119,4 @@ def test_enable_starttls_and_enable_starttls_auto
118119
assert_nothing_raised { smtp.enable_starttls_auto }
119120
end
120121
end
121-
end unless /mswin|mingw/ =~ RUBY_PLATFORM
122+
end

0 commit comments

Comments
 (0)