Exception: Tunit::Assertion

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

Direct Known Subclasses

Empty, Skip

Instance Method Summary collapse

Instance Method Details

#errorObject



3
4
5
# File 'lib/tunit/assertion_errors.rb', line 3

def error
  self
end

#locationObject



7
8
9
10
11
12
13
14
# File 'lib/tunit/assertion_errors.rb', line 7

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

#result_codeObject



16
17
18
# File 'lib/tunit/assertion_errors.rb', line 16

def result_code
  result_label[0, 1]
end

#result_labelObject



20
21
22
# File 'lib/tunit/assertion_errors.rb', line 20

def result_label
  "Failure"
end