Skip to content

Commit

Permalink
- Renamed UnexpectedError#exception to #error to avoid problems with …
Browse files Browse the repository at this point in the history
…reraising. (casperisfine)

[git-p4: depot-paths = "//src/minitest/dev/": change = 12411]
  • Loading branch information
zenspider committed Nov 23, 2019
1 parent ecb1afe commit 5802aa0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -907,24 +907,21 @@ def result_label # :nodoc:
# Assertion wrapping an unexpected error that was raised during a run.

class UnexpectedError < Assertion
attr_accessor :exception # :nodoc:
# TODO: figure out how to use `cause` instead
attr_accessor :error # :nodoc:

def initialize exception # :nodoc:
def initialize error # :nodoc:
super "Unexpected exception"
self.exception = exception
self.error = error
end

def backtrace # :nodoc:
self.exception.backtrace
end

def error # :nodoc:
self.exception
self.error.backtrace
end

def message # :nodoc:
bt = Minitest.filter_backtrace(self.backtrace).join "\n "
"#{self.exception.class}: #{self.exception.message}\n #{bt}"
"#{self.error.class}: #{self.error.message}\n #{bt}"
end

def result_label # :nodoc:
Expand Down

0 comments on commit 5802aa0

Please sign in to comment.