mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
[rubygems/rubygems] Support the change of did_you_mean about Exception#detailed_message
I am asking did_you_mean to use Exception#detailed_message to add
"Did you mean?" suggestion instead of overriding #message method.
https://github.com/ruby/did_you_mean/pull/177
Unfortunately, the change will affect Gem::UnknownCommandError, which
excepts did_you_mean to override #message method.
This PR absorbs the change of did_you_mean.
Gem::CommandManager now calls #detailed_message method to get a message
string with "Did you mean?" suggestion from an exception.
8f104228d3
This commit is contained in:
parent
4cf155e007
commit
663915ddf4
2 changed files with 13 additions and 2 deletions
|
@ -80,7 +80,13 @@ class TestGemCommandManager < Gem::TestCase
|
|||
message << "\nDid you mean? \"push\""
|
||||
end
|
||||
|
||||
assert_equal message, e.message
|
||||
if e.respond_to?(:detailed_message)
|
||||
actual_message = e.detailed_message(highlight: false).sub(/\A(.*?)(?: \(.+?\))/) { $1 }
|
||||
else
|
||||
actual_message = e.message
|
||||
end
|
||||
|
||||
assert_equal message, actual_message
|
||||
end
|
||||
|
||||
def test_run_interrupt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue