summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/fetcher_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/bundler/fetcher_spec.rb')
-rw-r--r--spec/bundler/bundler/fetcher_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/bundler/bundler/fetcher_spec.rb b/spec/bundler/bundler/fetcher_spec.rb
index f9e52e09c0..184b9efa64 100644
--- a/spec/bundler/bundler/fetcher_spec.rb
+++ b/spec/bundler/bundler/fetcher_spec.rb
@@ -95,11 +95,15 @@ RSpec.describe Bundler::Fetcher do
context "when bunder ssl ssl configuration is set" do
before do
+ cert = File.join(Spec::Path.tmpdir, "cert")
+ File.open(cert, "w") {|f| f.write "PEM" }
allow(Bundler.settings).to receive(:[]).and_return(nil)
- allow(Bundler.settings).to receive(:[]).with(:ssl_client_cert).and_return("/cert")
- expect(File).to receive(:read).with("/cert").and_return("")
- expect(OpenSSL::X509::Certificate).to receive(:new).and_return("cert")
- expect(OpenSSL::PKey::RSA).to receive(:new).and_return("key")
+ allow(Bundler.settings).to receive(:[]).with(:ssl_client_cert).and_return(cert)
+ expect(OpenSSL::X509::Certificate).to receive(:new).with("PEM").and_return("cert")
+ expect(OpenSSL::PKey::RSA).to receive(:new).with("PEM").and_return("key")
+ end
+ after do
+ FileUtils.rm File.join(Spec::Path.tmpdir, "cert")
end
it "use bundler configuration" do
expect(fetcher.send(:connection).cert).to eq("cert")