Skip to content

Instantly share code, notes, and snippets.

@zenspider
Created August 28, 2024 18:57
Show Gist options
  • Save zenspider/fd6b0268056d7d614b509b910f0950cf to your computer and use it in GitHub Desktop.
Save zenspider/fd6b0268056d7d614b509b910f0950cf to your computer and use it in GitHub Desktop.
diff -r old/lib/minitest/assertions.rb new/lib/minitest/assertions.rb
--- old/lib/minitest/assertions.rb
+++ new/lib/minitest/assertions.rb
@@ -212,8 +212,12 @@
# See also: Minitest::Assertions.diff
def assert_equal exp, act, msg = nil
- msg = message(msg, E) { diff exp, act }
- result = assert exp == act, msg
+ begin
+ result = assert exp == act
+ rescue Assertion
+ msg = message(msg, E) { diff exp, act }
+ raise Minitest::Assertion, msg.call
+ end
if nil == exp then
if Minitest::VERSION >= "6" then
@@ -433,9 +437,7 @@
rescue SignalException, SystemExit
raise
rescue Exception => e
- flunk proc {
- exception_details(e, "#{msg}#{mu_pp exp} exception expected, not")
- }
+ flunk exception_details(e, "#{msg}#{mu_pp exp} exception expected, not")
end
exp = exp.first if exp.size == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment