Class: RSpec::Core::Notifications::FailedExampleNotification

Inherits:
ExampleNotification show all
Defined in:
lib/rspec/core/notifications.rb

Overview

The FailedExampleNotification extends ExampleNotification with things useful for examples that have failure info -- typically a failed or pending spec.

Examples:

def example_failed(notification)
  puts "Hey I failed :("
  puts "Here's my stack trace"
  puts notification.exception.backtrace.join("\n")
end

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exampleRSpec::Core::Example

the current example



156
157
158
# File 'lib/rspec/core/notifications.rb', line 156

def example
  @example
end

Instance Method Details

#colorized_formatted_backtrace(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ Array<String>

Returns the failures colorized formatted backtrace.



195
196
197
# File 'lib/rspec/core/notifications.rb', line 195

def colorized_formatted_backtrace(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
  @exception_presenter.colorized_formatted_backtrace(colorizer)
end

#colorized_message_lines(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ Array<String>

Returns the message generated for this failure colorized line by line.



180
181
182
# File 'lib/rspec/core/notifications.rb', line 180

def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
  @exception_presenter.colorized_message_lines(colorizer)
end

#descriptionString



165
166
167
# File 'lib/rspec/core/notifications.rb', line 165

def description
  @exception_presenter.description
end

#exceptionException



160
161
162
# File 'lib/rspec/core/notifications.rb', line 160

def exception
  @exception_presenter.exception
end

#formatted_backtraceArray<String>

Returns the failures formatted backtrace.



187
188
189
# File 'lib/rspec/core/notifications.rb', line 187

def formatted_backtrace
  @exception_presenter.formatted_backtrace
end

#fully_formatted(failure_number, colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String



201
202
203
# File 'lib/rspec/core/notifications.rb', line 201

def fully_formatted(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
  @exception_presenter.fully_formatted(failure_number, colorizer)
end

#fully_formatted_lines(failure_number, colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ Array<string>



207
208
209
# File 'lib/rspec/core/notifications.rb', line 207

def fully_formatted_lines(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
  @exception_presenter.fully_formatted_lines(failure_number, colorizer)
end

#message_linesArray<String>

Returns the message generated for this failure line by line.



172
173
174
# File 'lib/rspec/core/notifications.rb', line 172

def message_lines
  @exception_presenter.message_lines
end