Exception: Minitest::UnexpectedError

Inherits:
Assertion show all
Defined in:
lib/minitest.rb

Overview

Assertion wrapping an unexpected error that was raised during a run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Assertion

#location, #result_code

Constructor Details

#initialize(error) ⇒ UnexpectedError

:nodoc:



980
981
982
983
# File 'lib/minitest.rb', line 980

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

Instance Attribute Details

#errorObject

TODO: figure out how to use ‘cause` instead



978
979
980
# File 'lib/minitest.rb', line 978

def error
  @error
end

Instance Method Details

#backtraceObject

:nodoc:



985
986
987
# File 'lib/minitest.rb', line 985

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

#messageObject

:nodoc:



989
990
991
992
# File 'lib/minitest.rb', line 989

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

#result_labelObject

:nodoc:



994
995
996
# File 'lib/minitest.rb', line 994

def result_label # :nodoc:
  "Error"
end