diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2024-05-24 19:47:22 +0200 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-30 18:23:36 +0000 |
| commit | 4f160ad9cfc0f2690a5acca301dedff4f901a673 (patch) | |
| tree | e430b0adbdaf8780c0e427cf39f7cb05ae793b77 /spec | |
| parent | 15501e13d7588a049437d343548bda76121b92f9 (diff) | |
[rubygems/rubygems] Don't let `bundle config` report a path without a Gemfile as "local app"
https://github.com/rubygems/rubygems/commit/6aa2ac337f
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/bundler/settings_spec.rb | 14 | ||||
| -rw-r--r-- | spec/bundler/commands/config_spec.rb | 8 |
2 files changed, 18 insertions, 4 deletions
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb index 634e0faf91..768372c608 100644 --- a/spec/bundler/bundler/settings_spec.rb +++ b/spec/bundler/bundler/settings_spec.rb @@ -6,12 +6,18 @@ RSpec.describe Bundler::Settings do subject(:settings) { described_class.new(bundled_app) } describe "#set_local" do - context "when the local config file is not found" do + context "root is nil" do subject(:settings) { described_class.new(nil) } - it "raises a GemfileNotFound error with explanation" do - expect { subject.set_local("foo", "bar") }. - to raise_error(Bundler::GemfileNotFound, "Could not locate Gemfile") + before do + allow(Pathname).to receive(:new).and_call_original + allow(Pathname).to receive(:new).with(".bundle").and_return home(".bundle") + end + + it "works" do + subject.set_local("foo", "bar") + + expect(subject["foo"]).to eq("bar") end end end diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index 547fd2d869..a1a6b3bd34 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -79,6 +79,14 @@ RSpec.describe ".bundle/config" do expect(home(".bundle/config")).to exist end + it "does not list global settings as local" do + bundle "config set --global foo bar" + bundle "config list", dir: home + + expect(out).to include("for the current user") + expect(out).not_to include("for your local app") + end + it "works with an absolute path" do ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s bundle "config set --local path vendor/bundle" |
