File tree Expand file tree Collapse file tree
bundler/lib/bundler/fetcher Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ def initialize(*)
99 super
1010
1111 @pool_size = Bundler . settings . installation_parallelization
12+ ssl_ca_cert = Bundler . settings [ :ssl_ca_cert ]
13+ @cert_files << ssl_ca_cert if ssl_ca_cert
1214 end
1315
1416 def request ( *args )
Original file line number Diff line number Diff line change 66require "bundler/vendored_persistent.rb"
77
88RSpec . describe Bundler ::Fetcher ::GemRemoteFetcher do
9+ describe "#initialize" do
10+ context "when ssl_ca_cert setting is not set" do
11+ before do
12+ allow ( Bundler . settings ) . to receive ( :[] ) . and_call_original
13+ allow ( Bundler . settings ) . to receive ( :[] ) . with ( :ssl_ca_cert ) . and_return ( nil )
14+ end
15+
16+ it "does not append the setting to @cert_files" do
17+ cert_files = subject . instance_variable_get ( :@cert_files )
18+ gem_cert_files = Gem ::Request . get_cert_files
19+ expect ( cert_files ) . to eq ( gem_cert_files )
20+ end
21+ end
22+
23+ context "when ssl_ca_cert setting is set" do
24+ let ( :ca_cert_path ) { "/path/to/ca_cert" }
25+
26+ before do
27+ allow ( Bundler . settings ) . to receive ( :[] ) . and_call_original
28+ allow ( Bundler . settings ) . to receive ( :[] ) . with ( :ssl_ca_cert ) . and_return ( ca_cert_path )
29+ end
30+
31+ it "appends the setting to @cert_files" do
32+ cert_files = subject . instance_variable_get ( :@cert_files )
33+ gem_cert_files = Gem ::Request . get_cert_files
34+ expect ( cert_files ) . to eq ( gem_cert_files + [ ca_cert_path ] )
35+ end
36+ end
37+ end
38+
939 describe "Parallel download" do
1040 it "download using multiple connections from the pool" do
1141 unless Bundler . rubygems . provides? ( ">= 4.0.0.dev" )
You can’t perform that action at this time.
0 commit comments