Class: Spec::Runner::Formatter::QuickfixFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Spec::Runner::Formatter::QuickfixFormatter
- Defined in:
- lib/spec/quickfix_formatter.rb
Constant Summary collapse
- MULTI_LINE_ERRORS =
turn this on to output multiline error in quickfix. This kinda abuses quickfix but can provide the backtrace
false
Instance Method Summary collapse
-
#example_failed(example, counter, failure) ⇒ Object
use with this errorformat set errorformat=%f:%l\ %n\ %m.
-
#initialize(options, output) ⇒ QuickfixFormatter
constructor
A new instance of QuickfixFormatter.
Constructor Details
#initialize(options, output) ⇒ QuickfixFormatter
Returns a new instance of QuickfixFormatter.
9 10 11 12 13 14 15 |
# File 'lib/spec/quickfix_formatter.rb', line 9 def initialize(, output) @options = @output = output unless @output.is_a?(IO) @output = File.new(output, 'w') end end |
Instance Method Details
#example_failed(example, counter, failure) ⇒ Object
use with this errorformat set errorformat=%f:%l\ %n\ %m
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/spec/quickfix_formatter.rb', line 19 def example_failed(example, counter, failure) first_time = true failure.exception.backtrace.reverse.each do |frame| file, line, = parse_backtrace(frame) = failure.header if .blank? if first_time and failure.exception..present? first_time = false += failure.exception. end @output.puts "%s:%d %d %s" % [file, line, counter, ] @output.flush MULTI_LINE_ERRORS or break end end |