Exception: Minitest::Assertion

Inherits:
Exception
  • Object
show all
Defined in:
lib/minitest.rb

Overview

Represents run failures.

Direct Known Subclasses

Skip, UnexpectedError, UnexpectedWarning

Constant Summary collapse

RE =

:nodoc:

/in [`'](?:[^']+[#.])?(?:assert|refute|flunk|pass|fail|raise|must|wont)/

Instance Method Summary collapse

Instance Method Details

#errorObject

:nodoc:



1023
1024
1025
# File 'lib/minitest.rb', line 1023

def error # :nodoc:
  self
end

#locationObject

Where was this run before an assertion was raised?



1030
1031
1032
1033
1034
1035
1036
# File 'lib/minitest.rb', line 1030

def location
  bt  = Minitest.filter_backtrace self.backtrace
  idx = bt.rindex { |s| s.match? RE } || -1 # fall back to first item
  loc = bt[idx+1] || bt.last || "unknown:-1"

  loc.sub(/:in .*$/, "")
end

#result_codeObject

:nodoc:



1038
1039
1040
# File 'lib/minitest.rb', line 1038

def result_code # :nodoc:
  result_label[0, 1]
end

#result_labelObject

:nodoc:



1042
1043
1044
# File 'lib/minitest.rb', line 1042

def result_label # :nodoc:
  "Failure"
end