Class: TestFailure
- Inherits:
-
TestResult
- Object
- TestResult
- TestFailure
- Defined in:
- lib/test_failure.rb
Overview
Test that has failed, either with a provided message or thrown error
Instance Method Summary collapse
- #failures ⇒ Object
-
#initialize(title, message = nil, err = nil) ⇒ TestFailure
constructor
A new instance of TestFailure.
- #report(spacer_count = 0) ⇒ Object
Methods included from Result
Constructor Details
#initialize(title, message = nil, err = nil) ⇒ TestFailure
Returns a new instance of TestFailure.
8 9 10 11 12 |
# File 'lib/test_failure.rb', line 8 def initialize(title, = nil, err = nil) super(title) = @err = err end |
Instance Method Details
#failures ⇒ Object
28 29 30 |
# File 'lib/test_failure.rb', line 28 def failures 1 end |
#report(spacer_count = 0) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/test_failure.rb', line 14 def report(spacer_count = 0) super Printer.fail(@spacer + ) return if @err.nil? # Extra space is to compensate for the [X] Printer.fail("#{@spacer} #{@err}") # Mimic the default Ruby trace. This does not need additional formatting as # some terminals recognize this as a stack trace. puts @err.backtrace.join("\n\t") .sub("\n\t", ": #{@err}#{@err.class ? " (#{@err.class})" : ''}\n\t") end |