summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-11-26 20:03:13 +0100
committergit <svn-admin@ruby-lang.org>2025-11-28 23:50:00 +0000
commit69293f52550032cbda8d92188407b8700f4c3bb1 (patch)
tree26cc1412cdff86cda24772a432814117e2df3260 /spec
parent7dae2a1f488afc4133dfbd6ea243aaeb71107f71 (diff)
[ruby/rubygems] Print help summary when the default command fail
As mentioned in https://github.com/ruby/rubygems/issues/9124, the intent for changing the default command was to be more welcoming. I think we can acheive that by attempting to install, but to print that same help message if there is no Gemfile. That should address both concerns. https://github.com/ruby/rubygems/commit/f3f505c02a
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/cli_spec.rb13
-rw-r--r--spec/bundler/other/cli_dispatch_spec.rb2
2 files changed, 2 insertions, 13 deletions
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 611c1985e2..33a23a75de 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -87,27 +87,16 @@ RSpec.describe "bundle executable" do
end
context "with no arguments" do
- it "installs by default" do
+ it "tries to installs by default but print help on missing Gemfile" do
bundle "", raise_on_error: false
expect(err).to include("Could not locate Gemfile")
- end
- it "prints a concise help message when default_cli_command set to cli_help" do
- bundle "config set default_cli_command cli_help"
- bundle ""
- expect(err).to be_empty
expect(out).to include("Bundler version #{Bundler::VERSION}").
and include("\n\nBundler commands:\n\n").
and include("\n\n Primary commands:\n").
and include("\n\n Utilities:\n").
and include("\n\nOptions:\n")
end
-
- it "runs bundle install when default_cli_command set to install" do
- bundle "config set default_cli_command install"
- bundle "", raise_on_error: false
- expect(err).to include("Could not locate Gemfile")
- end
end
context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do
diff --git a/spec/bundler/other/cli_dispatch_spec.rb b/spec/bundler/other/cli_dispatch_spec.rb
index 1039737b99..a2c745b070 100644
--- a/spec/bundler/other/cli_dispatch_spec.rb
+++ b/spec/bundler/other/cli_dispatch_spec.rb
@@ -15,6 +15,6 @@ RSpec.describe "bundle command names" do
it "print a friendly error when ambiguous" do
bundle "in", raise_on_error: false
- expect(err).to eq("Ambiguous command in matches [info, init, inject, install]")
+ expect(err).to eq("Ambiguous command in matches [info, init, install]")
end
end