Exception: Minitest::Assertion

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

Overview

Represents run failures.

Direct Known Subclasses

Skip, UnexpectedError

Instance Method Summary collapse

Instance Method Details

#errorObject

:nodoc:



816
817
818
# File 'lib/minitest.rb', line 816

def error # :nodoc:
  self
end

#locationObject

Where was this run before an assertion was raised?



823
824
825
826
827
828
829
830
# File 'lib/minitest.rb', line 823

def location
  last_before_assertion = ""
  self.backtrace.reverse_each do |s|
    break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
    last_before_assertion = s
  end
  last_before_assertion.sub(/:in .*$/, "")
end

#result_codeObject

:nodoc:



832
833
834
# File 'lib/minitest.rb', line 832

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

#result_labelObject

:nodoc:



836
837
838
# File 'lib/minitest.rb', line 836

def result_label # :nodoc:
  "Failure"
end