Class | RSpec::Core::Formatters::SnippetExtractor |
In: |
lib/rspec/core/formatters/snippet_extractor.rb
|
Parent: | Object |
@api private
Extracts code snippets by looking at the backtrace of the passed error and applies synax highlighting and line numbers using html.
@api private
Extract lines of code centered around a particular line within a source file.
@param [String] file filename @param [Fixnum] line line number @return [String] lines around the target line within the file (2 above and 1 below).
@api private
Adds line numbers to all lines and highlights the line where the failure occurred using html `span` tags.
@param [String] highlighted syntax-highlighted snippet surrounding the offending line of code @param [Fixnum] offending_line line where failure occured @return [String] completed snippet
@api private
Extract lines of code corresponding to a backtrace.
@param [String] backtrace the backtrace from a test failure @return [String] highlighted code snippet indicating where the test failure occured
@see post_process
@api private
Create a snippet from a line of code.
@param [String] error_line file name with line number (i.e. ‘foo_spec.rb:12’) @return [String] lines around the target line within the file
@see lines_around