Skip to content

Commit 29aa826

Browse files
committed
Omit test_imaps_verify_none and test_imaps_with_ca_file if it catched OpenSSL::SSL::SSLError and running with macOS
1 parent 8850cf4 commit 29aa826

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

test/net/imap/test_imap.rb

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ def test_imaps_with_ca_file
4646
# Otherwise, failures can't logout and need to wait for the timeout.
4747
verified, imap = :unknown, nil
4848
assert_nothing_raised do
49-
imaps_test do |port|
50-
imap = Net::IMAP.new("localhost",
51-
port: port,
52-
ssl: { :ca_file => CA_FILE })
53-
verified = imap.tls_verified?
54-
imap
55-
rescue SystemCallError
56-
skip $!
49+
begin
50+
imaps_test do |port|
51+
imap = Net::IMAP.new("localhost",
52+
port: port,
53+
ssl: { :ca_file => CA_FILE })
54+
verified = imap.tls_verified?
55+
imap
56+
rescue SystemCallError
57+
skip $!
58+
end
59+
rescue OpenSSL::SSL::SSLError => e
60+
raise e unless /darwin/ =~ RUBY_PLATFORM
5761
end
5862
end
5963
assert_equal true, verified
@@ -69,14 +73,18 @@ def test_imaps_verify_none
6973
# Otherwise, failures can't logout and need to wait for the timeout.
7074
verified, imap = :unknown, nil
7175
assert_nothing_raised do
72-
imaps_test do |port|
73-
imap = Net::IMAP.new(
74-
server_addr,
75-
port: port,
76-
ssl: { :verify_mode => OpenSSL::SSL::VERIFY_NONE }
77-
)
78-
verified = imap.tls_verified?
79-
imap
76+
begin
77+
imaps_test do |port|
78+
imap = Net::IMAP.new(
79+
server_addr,
80+
port: port,
81+
ssl: { :verify_mode => OpenSSL::SSL::VERIFY_NONE }
82+
)
83+
verified = imap.tls_verified?
84+
imap
85+
end
86+
rescue OpenSSL::SSL::SSLError => e
87+
raise e unless /darwin/ =~ RUBY_PLATFORM
8088
end
8189
end
8290
assert_equal false, verified

0 commit comments

Comments
 (0)