Exception: Spectre::Failure
Overview
The failure class containing information about spec failures created by assert and expect.
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
The file path where the failure occured.
-
#line ⇒ Object
readonly
The line where the failure occured.
-
#message ⇒ Object
readonly
A message describing the failure.
Instance Method Summary collapse
-
#initialize(message, call_stack = nil) ⇒ Failure
constructor
Constructs a new
Failureinstance with the given message and determines thefileandlinefrom the given call stack. -
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(message, call_stack = nil) ⇒ Failure
Constructs a new Failure instance with the given message and determines the file and line from the given call stack
132 133 134 135 136 137 |
# File 'lib/spectre.rb', line 132 def initialize , call_stack = nil super() @file, @line = get_call_location(call_stack || caller_locations) @message = end |
Instance Attribute Details
#file ⇒ Object (readonly)
The file path where the failure occured
125 126 127 |
# File 'lib/spectre.rb', line 125 def file @file end |
#line ⇒ Object (readonly)
The line where the failure occured
127 128 129 |
# File 'lib/spectre.rb', line 127 def line @line end |
#message ⇒ Object (readonly)
A message describing the failure
123 124 125 |
# File 'lib/spectre.rb', line 123 def @message end |
Instance Method Details
#to_s ⇒ Object
:nodoc:
140 141 142 |
# File 'lib/spectre.rb', line 140 def to_s "#{@message} - in #{@file}:#{@line}" end |