From 69293f52550032cbda8d92188407b8700f4c3bb1 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 26 Nov 2025 20:03:13 +0100 Subject: [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 --- spec/bundler/bundler/cli_spec.rb | 13 +------------ spec/bundler/other/cli_dispatch_spec.rb | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'spec') 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 -- cgit v1.2.3