summaryrefslogtreecommitdiff
path: root/test/net/imap
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-23 13:48:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-23 13:48:41 +0000
commit77b1d88513cb4aea0183fef256dc2d7f168a2b4b (patch)
treebb03c437b79b8cfff376bb3e33ff05423eb6172f /test/net/imap
parent535a28c73748874eed9016e48515f01a71c507eb (diff)
skip OpenSSL dependent tests if not available
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/imap')
-rw-r--r--test/net/imap/test_imap.rb34
1 files changed, 14 insertions, 20 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index df9cd8b8a22..0feabb91084 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -45,8 +45,8 @@ class IMAPTest < Test::Unit::TestCase
assert_match(/\A24-Jul-2009 01:23 [+\-]\d{4}\z/, s)
end
- def test_imaps_unknown_ca
- if defined?(OpenSSL)
+ if defined?(OpenSSL::SSL::SSLError)
+ def test_imaps_unknown_ca
assert_raise(OpenSSL::SSL::SSLError) do
imaps_test do |port|
begin
@@ -59,10 +59,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_with_ca_file
- if defined?(OpenSSL)
+ def test_imaps_with_ca_file
assert_nothing_raised do
imaps_test do |port|
begin
@@ -75,10 +73,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_verify_none
- if defined?(OpenSSL)
+ def test_imaps_verify_none
assert_nothing_raised do
imaps_test do |port|
Net::IMAP.new(SERVER_ADDR,
@@ -87,10 +83,8 @@ class IMAPTest < Test::Unit::TestCase
end
end
end
- end
- def test_imaps_post_connection_check
- if defined?(OpenSSL)
+ def test_imaps_post_connection_check
assert_raise(OpenSSL::SSL::SSLError) do
imaps_test do |port|
# SERVER_ADDR is different from the hostname in the certificate,
@@ -103,20 +97,20 @@ class IMAPTest < Test::Unit::TestCase
end
end
- def test_starttls
- imap = nil
- if defined?(OpenSSL)
+ if defined?(OpenSSL::SSL)
+ def test_starttls
+ imap = nil
starttls_test do |port|
imap = Net::IMAP.new("localhost", :port => port)
imap.starttls(:ca_file => CA_FILE)
imap
end
- end
- rescue SystemCallError
- skip $!
- ensure
- if imap && !imap.disconnected?
- imap.disconnect
+ rescue SystemCallError
+ skip $!
+ ensure
+ if imap && !imap.disconnected?
+ imap.disconnect
+ end
end
end