module Protest::TestWithErrors

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

Attributes

error[R]

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

Public Instance Methods

backtrace() click to toggle source

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

# File lib/protest/tests.rb, line 41
def backtrace
  @backtrace ||= Protest.backtrace_filter.filter_backtrace(raw_backtrace)
end
error_message() click to toggle source

Message with which it failed the assertion.

# File lib/protest/tests.rb, line 25
def error_message
  error.message
end
file() click to toggle source

File where the assertion failed.

# File lib/protest/tests.rb, line 35
def file
  backtrace.first.split(":")[0]
end
line() click to toggle source

Line of the file where the assertion failed.

# File lib/protest/tests.rb, line 30
def line
  backtrace.first.split(":")[1]
end
raw_backtrace() click to toggle source

Raw backtrace, as provided by the error.

# File lib/protest/tests.rb, line 46
def raw_backtrace
  error.backtrace
end