diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-28 13:48:35 +0200 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-06-28 13:48:45 +0200 |
commit | 1f422b9aa9899acf3319ef18c59f2985d8e779b5 (patch) | |
tree | a364ea134c90c46c5ea4f9b9946895966e696a0f | |
parent | ad7ae9585b390a4cc04f466349b8468da5e0018b (diff) | |
download | bundler-seg-vendor-fileutils.tar.gz |
Fix expectations to adapt to the fileutils bundler is usingseg-vendor-fileutils
-rw-r--r-- | spec/bundler/bundler_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/settings_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/ssl_certs/certificate_manager_spec.rb | 8 | ||||
-rw-r--r-- | spec/support/helpers.rb | 8 |
4 files changed, 15 insertions, 7 deletions
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb index 73720de967..3f4ebdd0ac 100644 --- a/spec/bundler/bundler_spec.rb +++ b/spec/bundler/bundler_spec.rb @@ -157,7 +157,7 @@ RSpec.describe Bundler do let(:bundler_ui) { Bundler.ui } it "should raise a friendly error" do allow(File).to receive(:exist?).and_return(true) - allow(Bundler::FileUtils).to receive(:remove_entry_secure).and_raise(ArgumentError) + allow(bundler_fileutils).to receive(:remove_entry_secure).and_raise(ArgumentError) allow(File).to receive(:world_writable?).and_return(true) message = <<EOF It is a security vulnerability to allow your home directory to be world-writable, and bundler can not continue. diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb index ab17ff5a39..d680ab3f3e 100644 --- a/spec/bundler/settings_spec.rb +++ b/spec/bundler/settings_spec.rb @@ -119,7 +119,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow context "when it's not possible to write to the file" do it "raises an PermissionError with explanation" do - expect(Bundler::FileUtils).to receive(:mkdir_p).with(settings.send(:local_config_file).dirname). + expect(bundler_fileutils).to receive(:mkdir_p).with(settings.send(:local_config_file).dirname). and_raise(Errno::EACCES) expect { settings[:frozen] = "1" }. to raise_error(Bundler::PermissionError, /config/) @@ -142,7 +142,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow describe "#set_global" do context "when it's not possible to write to the file" do it "raises an PermissionError with explanation" do - expect(Bundler::FileUtils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname). + expect(bundler_fileutils).to receive(:mkdir_p).with(settings.send(:global_config_file).dirname). and_raise(Errno::EACCES) expect { settings.set_global(:frozen, "1") }. to raise_error(Bundler::PermissionError, %r{\.bundle/config}) diff --git a/spec/bundler/ssl_certs/certificate_manager_spec.rb b/spec/bundler/ssl_certs/certificate_manager_spec.rb index 696b90e768..7cf601f6db 100644 --- a/spec/bundler/ssl_certs/certificate_manager_spec.rb +++ b/spec/bundler/ssl_certs/certificate_manager_spec.rb @@ -71,17 +71,17 @@ RSpec.describe Bundler::SSLCerts::CertificateManager do context "when certificate manager is not up to date" do before do allow(subject).to receive(:up_to_date?).and_return(false) - allow(Bundler::FileUtils).to receive(:rm) - allow(Bundler::FileUtils).to receive(:cp) + allow(bundler_fileutils).to receive(:rm) + allow(bundler_fileutils).to receive(:cp) end it "should remove the current bundler certs" do - expect(Bundler::FileUtils).to receive(:rm).with(subject.bundler_certs) + expect(bundler_fileutils).to receive(:rm).with(subject.bundler_certs) subject.update! end it "should copy the rubygems certs into bundler certs" do - expect(Bundler::FileUtils).to receive(:cp).with(subject.rubygems_certs, subject.bundler_cert_path) + expect(bundler_fileutils).to receive(:cp).with(subject.rubygems_certs, subject.bundler_cert_path) subject.update! end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index b31b0f05c1..03d9711878 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -514,5 +514,13 @@ module Spec end port end + + def bundler_fileutils + if RUBY_VERSION >= "2.4" + ::Bundler::FileUtils + else + ::FileUtils + end + end end end |