diff options
author | Edouard CHIN <[email protected]> | 2025-04-10 00:31:55 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2025-04-22 11:27:24 +0900 |
commit | 56c1a15eb70eaed2acf84cb449f19a9745dcfe44 (patch) | |
tree | 190778dd590cdd89d10dca9841611cbfa0218703 /spec/bundler/commands/ssl_spec.rb | |
parent | ff2e0e41730f21b29660254d29cf5bb3ceffdbd4 (diff) |
[rubygems/rubygems] Warn if TLS 1.2 is not supported
https://github.com/rubygems/rubygems/commit/e4f70a3e4f
Diffstat (limited to 'spec/bundler/commands/ssl_spec.rb')
-rw-r--r-- | spec/bundler/commands/ssl_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/bundler/commands/ssl_spec.rb b/spec/bundler/commands/ssl_spec.rb index 38bc2445c7..52329bc0f3 100644 --- a/spec/bundler/commands/ssl_spec.rb +++ b/spec/bundler/commands/ssl_spec.rb @@ -334,5 +334,39 @@ RSpec.describe "bundle doctor ssl" do expect(net_http.min_version.to_s).to eq("TLS1_3") expect(net_http.max_version.to_s).to eq("TLS1_3") end + + it "warns when TLS1.2 is not supported" do + expected_out = <<~MSG + Here's your OpenSSL environment: + + OpenSSL: #{OpenSSL::VERSION} + Compiled with: #{OpenSSL::OPENSSL_VERSION} + Loaded with: #{OpenSSL::OPENSSL_LIBRARY_VERSION} + + Trying connections to https://rubygems.org: + Bundler: success + RubyGems: success + Ruby net/http: success + + Hooray! This Ruby can connect to rubygems.org. + You are all set to use Bundler and RubyGems. + + MSG + + expected_err = <<~MSG + + WARNING: Although your Ruby can connect to rubygems.org today, your OpenSSL is very old! + WARNING: You will need to upgrade OpenSSL to use rubygems.org. + + MSG + + previous_version = OpenSSL::SSL::TLS1_2_VERSION + OpenSSL::SSL.send(:remove_const, :TLS1_2_VERSION) + + subject = Bundler::CLI::Doctor::SSL.new({}) + expect { subject.run }.to output(expected_out).to_stdout.and output(expected_err).to_stderr + ensure + OpenSSL::SSL.const_set(:TLS1_2_VERSION, previous_version) + end end end |