diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-09 20:52:48 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-09 21:10:48 +0900 |
commit | b194973dcd5eda6c9e256029ea39dc532ae18962 (patch) | |
tree | 30ebee5b13e2c3511ab3a41fc6219a779d89ad8f /test/openssl/test_x509store.rb | |
parent | 6997109fcaef0567f176e53dfc092aecc49f9ece (diff) | |
download | ruby-b194973dcd5eda6c9e256029ea39dc532ae18962.tar.gz |
Revert the related commits about `Tempfile.open` change.
Start with https://github.com/ruby/ruby/commit/fa21985a7a2f8f52a8bd82bd12a724e9dca74934
to https://github.com/ruby/ruby/commit/d7492a0be885ea9f2b9f71e3e95582f9a859c439
Diffstat (limited to 'test/openssl/test_x509store.rb')
-rw-r--r-- | test/openssl/test_x509store.rb | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/test/openssl/test_x509store.rb b/test/openssl/test_x509store.rb index e1898d62b9..1cbc73d539 100644 --- a/test/openssl/test_x509store.rb +++ b/test/openssl/test_x509store.rb @@ -33,21 +33,20 @@ class OpenSSL::TestX509Store < OpenSSL::TestCase ] cert1 = issue_cert(@ca1, @rsa1024, 1, ca_exts, nil, nil) cert2 = issue_cert(@ca2, @rsa2048, 1, ca_exts, nil, nil) - Tempfile.open { |tmpfile| - tmpfile << cert1.to_pem << cert2.to_pem - tmpfile.close - - store = OpenSSL::X509::Store.new - assert_equal false, store.verify(cert1) - assert_equal false, store.verify(cert2) - store.add_file(tmpfile.path) - assert_equal true, store.verify(cert1) - assert_equal true, store.verify(cert2) - - # OpenSSL < 1.1.1 leaks an error on a duplicate certificate - assert_nothing_raised { store.add_file(tmpfile.path) } - assert_equal [], OpenSSL.errors - } + tmpfile = Tempfile.open { |f| f << cert1.to_pem << cert2.to_pem; f } + + store = OpenSSL::X509::Store.new + assert_equal false, store.verify(cert1) + assert_equal false, store.verify(cert2) + store.add_file(tmpfile.path) + assert_equal true, store.verify(cert1) + assert_equal true, store.verify(cert2) + + # OpenSSL < 1.1.1 leaks an error on a duplicate certificate + assert_nothing_raised { store.add_file(tmpfile.path) } + assert_equal [], OpenSSL.errors + ensure + tmpfile and tmpfile.close! end def test_verify |