summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-20 11:27:11 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-28 13:48:45 +0200
commitad7ae9585b390a4cc04f466349b8468da5e0018b (patch)
tree29649bc8715aaf9d502488790331f38e6357ca9c
parent60e20975a6082dcab7352b59d095cbc4b4400e99 (diff)
downloadbundler-ad7ae9585b390a4cc04f466349b8468da5e0018b.tar.gz
Mock Bundler::FileUtils when necessary
-rw-r--r--spec/bundler/bundler_spec.rb2
-rw-r--r--spec/bundler/settings_spec.rb4
-rw-r--r--spec/bundler/ssl_certs/certificate_manager_spec.rb8
3 files changed, 7 insertions, 7 deletions
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index c73bbf3670..73720de967 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(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 1acd2a97b3..ab17ff5a39 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(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(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 697bf7757b..696b90e768 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(FileUtils).to receive(:rm)
- allow(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(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(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