Skip to content

Instantly share code, notes, and snippets.

@nagachika
Created November 14, 2011 15:34
Show Gist options
  • Save nagachika/1364187 to your computer and use it in GitHub Desktop.
Save nagachika/1364187 to your computer and use it in GitHub Desktop.
patch for openssl test to suppress message.
diff --git a/test/openssl/test_engine.rb b/test/openssl/test_engine.rb
index fce5f76..db80521 100644
--- a/test/openssl/test_engine.rb
+++ b/test/openssl/test_engine.rb
@@ -41,6 +41,10 @@ class OpenSSL::TestEngine < Test::Unit::TestCase
end
def test_openssl_engine_cipher_rc4
+ # suppress message from OpenSSL
+ tmpfile = Tempfile.new("openssl_cipher_rc4")
+ stderr_back = $stderr.dup
+ $stderr.reopen(tmpfile)
engine = OpenSSL::Engine.by_id("openssl")
algo = "RC4" #AES is not supported by openssl Engine (<=1.0.0e)
data = "a" * 1000
@@ -59,6 +63,10 @@ class OpenSSL::TestEngine < Test::Unit::TestCase
assert_equal(data, decrypted)
cleanup
+ ensure
+ if stderr_back
+ $stderr.reopen(stderr_back)
+ end
end
private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment