Class: Validator::Brief

Inherits:
FormatterBase show all
Defined in:
spec/support/formatters/brief.rb

Instance Method Summary collapse

Methods inherited from FormatterBase

#close, #colorize, #dump_pending, #dump_sentinel_summary, #dump_sentinel_warnings, #dump_summary, #initialize, #start

Constructor Details

This class inherits a constructor from Validator::FormatterBase

Instance Method Details

#dump_failures(notification) ⇒ Object



48
49
# File 'spec/support/formatters/brief.rb', line 48

def dump_failures notification
end

#example_failed(notification) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'spec/support/formatters/brief.rb', line 31

def example_failed notification
  @output << colorize("#{indent}#{notification.example.description}",:failure)

  # expect { }.not_to raise_error might raise an RSpec::Expectations::ExpectationNotMetError,
  # with a messager that includes a backtrace. we don't want to show that here, so remove it
  message = notification.example.execution_result.exception.message.strip.
    gsub(/^\s+/,'').
    gsub(/\n+/,', ').
    sub /\s+with backtrace\:.*/m, ''
  @output << colorize(" - Failed: #{message}\n",:white)
end

#example_group_finished(notification) ⇒ Object



22
23
24
25
# File 'spec/support/formatters/brief.rb', line 22

def example_group_finished notification
  super
  @output << "\n" if @groups.empty?
end

#example_group_started(notification) ⇒ Object



17
18
19
20
# File 'spec/support/formatters/brief.rb', line 17

def example_group_started notification
  @output <<  "#{indent}#{notification.group.description}\n"
  super
end

#example_passed(notification) ⇒ Object



27
28
29
# File 'spec/support/formatters/brief.rb', line 27

def example_passed notification
  @output <<  colorize("#{indent}#{notification.example.description}\n",:success)
end

#example_pending(notification) ⇒ Object



43
44
45
46
# File 'spec/support/formatters/brief.rb', line 43

def example_pending notification
  @output << colorize("#{indent}#{notification.example.description} - " \
    "Pending: #{notification.example.execution_result.pending_message}\n",:pending)
end

#indentObject



9
10
11
# File 'spec/support/formatters/brief.rb', line 9

def indent
  ' '*(@groups.count*2)
end

#warning(notification) ⇒ Object



13
14
15
# File 'spec/support/formatters/brief.rb', line 13

def warning notification
  @output << colorize("    Warning: #{notification.message}\n",:yellow)
end