@@ -3,91 +3,91 @@ require "openssl"
33
44describe OpenSSL ::SSL ::Context do
55 it " new_for_client" do
6- ssl_context = OpenSSL ::SSL ::Context .new_for_client
6+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
77 ssl_context.verify_mode.should eq(OpenSSL ::SSL ::VerifyMode ::PEER )
8- OpenSSL ::SSL ::Context .new_for_client (LibSSL .tlsv1_method)
8+ OpenSSL ::SSL ::Context :: Client .new (LibSSL .tlsv1_method)
99 end
1010
1111 it " new_for_server" do
12- ssl_context = OpenSSL ::SSL ::Context .new_for_server
12+ ssl_context = OpenSSL ::SSL ::Context :: Server .new
1313 ssl_context.verify_mode.should eq(OpenSSL ::SSL ::VerifyMode ::NONE )
14- OpenSSL ::SSL ::Context .new_for_server (LibSSL .tlsv1_method)
14+ OpenSSL ::SSL ::Context :: Server .new (LibSSL .tlsv1_method)
1515 end
1616
1717 it " sets certificate chain" do
18- ssl_context = OpenSSL ::SSL ::Context .new_for_client
18+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
1919 ssl_context.certificate_chain = File .join(__DIR__, " openssl.crt" )
2020 end
2121
2222 it " fails to set certificate chain" do
23- ssl_context = OpenSSL ::SSL ::Context .new_for_client
23+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
2424 expect_raises(OpenSSL ::Error ) { ssl_context.certificate_chain = File .join(__DIR__, " unknown.crt" ) }
2525 expect_raises(OpenSSL ::Error ) { ssl_context.certificate_chain = __FILE__ }
2626 end
2727
2828 it " sets private key" do
29- ssl_context = OpenSSL ::SSL ::Context .new_for_client
29+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
3030 ssl_context.private_key = File .join(__DIR__, " openssl.key" )
3131 end
3232
3333 it " fails to set private key" do
34- ssl_context = OpenSSL ::SSL ::Context .new_for_client
34+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
3535 expect_raises(OpenSSL ::Error ) { ssl_context.private_key = File .join(__DIR__, " unknown.key" ) }
3636 expect_raises(OpenSSL ::Error ) { ssl_context.private_key = __FILE__ }
3737 end
3838
3939 it " sets ciphers" do
4040 ciphers = " EDH+aRSA DES-CBC3-SHA !RC4"
41- ssl_context = OpenSSL ::SSL ::Context .new_for_client
41+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
4242 (ssl_context.ciphers = ciphers).should eq(ciphers)
4343 end
4444
4545 it " adds temporary ecdh curve (P-256)" do
46- ssl_context = OpenSSL ::SSL ::Context .new_for_client
46+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
4747 ssl_context.set_tmp_ecdh_key
4848 end
4949
5050 it " adds options" do
51- ssl_context = OpenSSL ::SSL ::Context .new_for_client
51+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
5252 ssl_context.remove_options(ssl_context.options) # reset
5353 ssl_context.add_options(LibSSL ::Options ::ALL ).should eq(LibSSL ::Options ::ALL )
5454 ssl_context.add_options(LibSSL ::Options ::NO_SSLV2 | LibSSL ::Options ::NO_SSLV3 )
5555 .should eq(LibSSL ::Options ::ALL | LibSSL ::Options ::NO_SSLV2 | LibSSL ::Options ::NO_SSLV3 )
5656 end
5757
5858 it " removes options" do
59- ssl_context = OpenSSL ::SSL ::Context .new_for_client
59+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
6060 ssl_context.add_options(LibSSL ::Options ::ALL | LibSSL ::Options ::NO_SSLV2 )
6161 ssl_context.remove_options(LibSSL ::Options ::ALL ).should eq(LibSSL ::Options ::NO_SSLV2 )
6262 end
6363
6464 it " returns options" do
65- ssl_context = OpenSSL ::SSL ::Context .new_for_client
65+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
6666 ssl_context.add_options(LibSSL ::Options ::ALL | LibSSL ::Options ::NO_SSLV2 )
6767 ssl_context.options.should eq(LibSSL ::Options ::ALL | LibSSL ::Options ::NO_SSLV2 )
6868 end
6969
7070 it " adds modes" do
71- ssl_context = OpenSSL ::SSL ::Context .new_for_client
71+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
7272 ssl_context.add_modes(LibSSL ::Modes ::AUTO_RETRY ).should eq(LibSSL ::Modes ::AUTO_RETRY )
7373 ssl_context.add_modes(LibSSL ::Modes ::RELEASE_BUFFERS )
7474 .should eq(LibSSL ::Modes ::AUTO_RETRY | LibSSL ::Modes ::RELEASE_BUFFERS )
7575 end
7676
7777 it " removes modes" do
78- ssl_context = OpenSSL ::SSL ::Context .new_for_client
78+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
7979 ssl_context.add_modes(LibSSL ::Modes ::AUTO_RETRY | LibSSL ::Modes ::RELEASE_BUFFERS )
8080 ssl_context.remove_modes(LibSSL ::Modes ::AUTO_RETRY ).should eq(LibSSL ::Modes ::RELEASE_BUFFERS )
8181 end
8282
8383 it " returns modes" do
84- ssl_context = OpenSSL ::SSL ::Context .new_for_client
84+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
8585 ssl_context.add_modes(LibSSL ::Modes ::AUTO_RETRY | LibSSL ::Modes ::RELEASE_BUFFERS )
8686 ssl_context.modes.should eq(LibSSL ::Modes ::AUTO_RETRY | LibSSL ::Modes ::RELEASE_BUFFERS )
8787 end
8888
8989 it " sets the verify mode" do
90- ssl_context = OpenSSL ::SSL ::Context .new_for_client
90+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
9191 ssl_context.verify_mode = OpenSSL ::SSL ::VerifyMode ::NONE
9292 ssl_context.verify_mode.should eq(OpenSSL ::SSL ::VerifyMode ::NONE )
9393 ssl_context.verify_mode = OpenSSL ::SSL ::VerifyMode ::PEER
@@ -96,7 +96,7 @@ describe OpenSSL::SSL::Context do
9696
9797 pending " alpn_protocol=" do
9898 # requires OpenSSL 1.0.2+
99- ssl_context = OpenSSL ::SSL ::Context .new_for_client
99+ ssl_context = OpenSSL ::SSL ::Context :: Client .new
100100 ssl_context.alpn_protocol = " h2"
101101 end
102102end
0 commit comments