Class: Testicles::Report::FailedTest

Inherits:
PassedTest show all
Defined in:
lib/testicles/report.rb

Overview

Encapsulates the relevant information for a test which failed an assertion.

Direct Known Subclasses

ErroredTest, PendingTest

Instance Attribute Summary

Attributes inherited from PassedTest

#test_name

Instance Method Summary collapse

Constructor Details

#initialize(test_name, error) ⇒ FailedTest

:nodoc:



135
136
137
138
# File 'lib/testicles/report.rb', line 135

def initialize(test_name, error) #:nodoc:
  super(test_name)
  @error = error
end

Instance Method Details

#backtraceObject

Backtrace of the assertion



156
157
158
# File 'lib/testicles/report.rb', line 156

def backtrace
  @error.backtrace
end

#error_messageObject

Message with which it failed the assertion



141
142
143
# File 'lib/testicles/report.rb', line 141

def error_message
  @error.message
end

#fileObject

File where the assertion failed



151
152
153
# File 'lib/testicles/report.rb', line 151

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

#lineObject

Line of the file where the assertion failed



146
147
148
# File 'lib/testicles/report.rb', line 146

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