summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-16 14:02:03 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-18 13:44:03 +0900
commitcc644c7116c7e540809e381be9d16a2f29a45f43 (patch)
treede80a45178621327d790162107125a159eea364d /spec
parenta02dbcecb15bff9c2a21f5d5e021707a3b150a57 (diff)
[bundler/bundler] Fix `bundle doctor` command
Previously `bundle doctor` would fail on any bundle that does not include git gems or plugins. This is because the previously used `Bundler.home` does not exist unless the bundle includes git gems or plugins. For example, with `bundle config set path .bundle`, it points to which does not exist unless this kind of gems exist in the Gemfile. The name `Bundler.home` is really unfortunate, it should probably be have more descriptive name, and be private. But for now I just want to make `bundle doctor` usable. https://github.com/bundler/bundler/commit/5531a18c1e
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/doctor_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/bundler/commands/doctor_spec.rb b/spec/bundler/commands/doctor_spec.rb
index 4198678baa..d829f00092 100644
--- a/spec/bundler/commands/doctor_spec.rb
+++ b/spec/bundler/commands/doctor_spec.rb
@@ -22,11 +22,17 @@ RSpec.describe "bundle doctor" do
end
end
+ it "succeeds on a sane installation" do
+ bundle :doctor
+
+ expect(exitstatus).to eq(0)
+ end
+
context "when all files in home are readable/writable" do
before(:each) do
stat = double("stat")
unwritable_file = double("file")
- allow(Find).to receive(:find).with(Bundler.home.to_s) { [unwritable_file] }
+ allow(Find).to receive(:find).with(Bundler.bundle_path.to_s) { [unwritable_file] }
allow(File).to receive(:stat).with(unwritable_file) { stat }
allow(stat).to receive(:uid) { Process.uid }
allow(File).to receive(:writable?).with(unwritable_file) { true }
@@ -66,7 +72,7 @@ RSpec.describe "bundle doctor" do
before(:each) do
@stat = double("stat")
@unwritable_file = double("file")
- allow(Find).to receive(:find).with(Bundler.home.to_s) { [@unwritable_file] }
+ allow(Find).to receive(:find).with(Bundler.bundle_path.to_s) { [@unwritable_file] }
allow(File).to receive(:stat).with(@unwritable_file) { @stat }
end