diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-03-17 20:10:17 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-03-24 13:25:07 +0900 |
| commit | 4fe882e2c925c067693fbd432228d92548481ec4 (patch) | |
| tree | 571d76e57474da9a7fcfd5861d982ae26b2fa7a7 /test | |
| parent | ee7cfb1d1ec25f38c14e5d3cec72ed87937ef1c4 (diff) | |
[rubygems/rubygems] Let `gem exec` raise an error in ambiguous cases
When `gem exec foo` is run, and "foo" is a gem that has multiple
executables, none of them named "foo", raise an error explaining the
situation and telling user to be more specific.
Currently the first command in the executables array is run, but this
may come as surprising sometimes, so better raise an error.
https://github.com/rubygems/rubygems/commit/acda5d8f6e
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12968
Diffstat (limited to 'test')
| -rw-r--r-- | test/rubygems/test_gem_commands_exec_command.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_commands_exec_command.rb b/test/rubygems/test_gem_commands_exec_command.rb index b9d5888068..806a6b5424 100644 --- a/test/rubygems/test_gem_commands_exec_command.rb +++ b/test/rubygems/test_gem_commands_exec_command.rb @@ -370,8 +370,11 @@ class TestGemCommandsExecCommand < Gem::TestCase util_clear_gems use_ui @ui do - @cmd.invoke "a:2" - assert_equal "a-2 foo\n", @ui.output + e = assert_raise Gem::MockGemUi::TermError do + @cmd.invoke "a:2" + end + assert_equal 1, e.exit_code + assert_equal "ERROR: Ambiguous which executable from gem `a` should be run: the options are [\"foo\", \"bar\"], specify one via COMMAND, and use `-g` and `-v` to specify gem and version\n", @ui.error end end |
