diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-30 20:58:31 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-30 20:58:31 +0000 |
commit | f7b12afff5f7779ab0f6542abe41a356a32cc142 (patch) | |
tree | d2a0b33481ac3781f02dd5be56fe8a4394d834b0 /test | |
parent | 6ceb07bcdfb2e41c7d412c2d73821e7f75155db1 (diff) | |
download | ruby-f7b12afff5f7779ab0f6542abe41a356a32cc142.tar.gz |
* test/net/imap/test_imap.rb: check OpenSSL definition before testing imaps.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/imap/test_imap.rb | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index eba9bb242a..bc36f103e3 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -19,50 +19,60 @@ class IMAPTest < Test::Unit::TestCase end def test_imaps_unknown_ca - assert_raise(OpenSSL::SSL::SSLError) do - imaps_test do |port| - Net::IMAP.new("localhost", - :port => port, - :ssl => true) + if defined?(OpenSSL) + assert_raise(OpenSSL::SSL::SSLError) do + imaps_test do |port| + Net::IMAP.new("localhost", + :port => port, + :ssl => true) + end end end end def test_imaps_with_ca_file - assert_nothing_raised do - imaps_test do |port| - Net::IMAP.new("localhost", - :port => port, - :ssl => { :ca_file => CA_FILE }) + if defined?(OpenSSL) + assert_nothing_raised do + imaps_test do |port| + Net::IMAP.new("localhost", + :port => port, + :ssl => { :ca_file => CA_FILE }) + end end end end def test_imaps_verify_none - assert_nothing_raised do - imaps_test do |port| - Net::IMAP.new("localhost", - :port => port, - :ssl => { :verify_mode => OpenSSL::SSL::VERIFY_NONE }) + if defined?(OpenSSL) + assert_nothing_raised do + imaps_test do |port| + Net::IMAP.new("localhost", + :port => port, + :ssl => { :verify_mode => OpenSSL::SSL::VERIFY_NONE }) + end end end end def test_imaps_post_connection_check - assert_raise(OpenSSL::SSL::SSLError) do - imaps_test do |port| - Net::IMAP.new("127.0.0.1", - :port => port, - :ssl => { :ca_file => CA_FILE }) + if defined?(OpenSSL) + assert_raise(OpenSSL::SSL::SSLError) do + imaps_test do |port| + Net::IMAP.new("127.0.0.1", + :port => port, + :ssl => { :ca_file => CA_FILE }) + end end end end def test_starttls - starttls_test do |port| - imap = Net::IMAP.new("localhost", :port => port) - imap.starttls(:ca_file => CA_FILE) - imap + if defined?(OpenSSL) + starttls_test do |port| + imap = Net::IMAP.new("localhost", :port => port) + imap.starttls(:ca_file => CA_FILE) + imap + end end end |