summaryrefslogtreecommitdiff
path: root/test/did_you_mean/helper.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-06-07 15:24:48 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-06-07 15:24:48 +0900
commit11b9dd8ccb26a091b99230640494540ad0cc4e48 (patch)
treefb80532651cffb2d1609f1a237a1fa72b83bdf45 /test/did_you_mean/helper.rb
parentb9f030954a8a1572032f3548b39c5b8ac35792ce (diff)
Manually merged https://github.com/ruby/did_you_mean/pull/177
Diffstat (limited to 'test/did_you_mean/helper.rb')
-rw-r--r--test/did_you_mean/helper.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/did_you_mean/helper.rb b/test/did_you_mean/helper.rb
index 7cb7b10282..d40d58d95d 100644
--- a/test/did_you_mean/helper.rb
+++ b/test/did_you_mean/helper.rb
@@ -29,5 +29,15 @@ module DidYouMean
def assert_correction(expected, array)
assert_equal Array(expected), array, "Expected #{array.inspect} to only include #{expected.inspect}"
end
+
+ def get_message(err)
+ if err.respond_to?(:detailed_message)
+ err.detailed_message(highlight: false)
+ else
+ err.to_s
+ end
+ end
+
+ module_function :get_message
end
end