Module: Protest::TestWithErrors

Included in:
ErroredTest, FailedTest, PendingTest
Defined in:
lib/protest/tests.rb

Overview

Mixin for tests that had an error (this could be either a failed assertion, unrescued exceptions, or just a pending tests.)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject (readonly)

The triggered exception (AssertionFailed, Pending, or any subclass of Exception in the case of an ErroredTest.)



22
23
24
# File 'lib/protest/tests.rb', line 22

def error
  @error
end

Instance Method Details

#backtraceObject

Filtered backtrace of the assertion. See Protest::Utils::BacktraceFilter for details on the filtering.



41
42
43
# File 'lib/protest/tests.rb', line 41

def backtrace
  @backtrace ||= Protest.backtrace_filter.filter_backtrace(raw_backtrace)
end

#error_messageObject

Message with which it failed the assertion.



25
26
27
# File 'lib/protest/tests.rb', line 25

def error_message
  error.message
end

#fileObject

File where the assertion failed.



35
36
37
# File 'lib/protest/tests.rb', line 35

def file
  backtrace.first.split(":")[0]
end

#lineObject

Line of the file where the assertion failed.



30
31
32
# File 'lib/protest/tests.rb', line 30

def line
  backtrace.first.split(":")[1]
end

#raw_backtraceObject

Raw backtrace, as provided by the error.



46
47
48
# File 'lib/protest/tests.rb', line 46

def raw_backtrace
  error.backtrace
end