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:



592
593
594
# File 'lib/minitest.rb', line 592

def error # :nodoc:
  self
end

#locationObject

Where was this run before an assertion was raised?



599
600
601
602
603
604
605
606
# File 'lib/minitest.rb', line 599

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:



608
609
610
# File 'lib/minitest.rb', line 608

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

#result_labelObject

:nodoc:



612
613
614
# File 'lib/minitest.rb', line 612

def result_label # :nodoc:
  "Failure"
end