Class: Aspec::Formatter::Terminal

Inherits:
Object
  • Object
show all
Includes:
Term::ANSIColor
Defined in:
lib/aspec/formatters/terminal.rb

Instance Method Summary collapse

Constructor Details

#initialize(verbose, out = STDOUT) ⇒ Terminal


7
8
9
10
11
# File 'lib/aspec/formatters/terminal.rb', line 7

def initialize(verbose, out = STDOUT)
  @out = out
  @verbose = verbose
  @line_buffer ||= []
end

Instance Method Details

#clearObject


13
14
15
# File 'lib/aspec/formatters/terminal.rb', line 13

def clear
  @line_buffer.clear
end

#comment(comment_string) ⇒ Object


17
18
19
# File 'lib/aspec/formatters/terminal.rb', line 17

def comment(comment_string)
  line(comment_string)
end

#debug(step) ⇒ Object


38
39
40
# File 'lib/aspec/formatters/terminal.rb', line 38

def debug(step)
  @out.puts(step.inspect)
end

#dump_summary(summary) ⇒ Object


42
43
44
# File 'lib/aspec/formatters/terminal.rb', line 42

def dump_summary(summary)
  @out.puts summary
end

#exception(error_string) ⇒ Object


21
22
23
# File 'lib/aspec/formatters/terminal.rb', line 21

def exception(error_string)
  line(error_string)
end

#step_error(step) ⇒ Object


29
30
31
32
# File 'lib/aspec/formatters/terminal.rb', line 29

def step_error(step)
  line(red + step_line(step) + reset)
  print_error unless @verbose
end

#step_error_title(step) ⇒ Object


25
26
27
# File 'lib/aspec/formatters/terminal.rb', line 25

def step_error_title(step)
  step_line(step)
end

#step_pass(step) ⇒ Object


34
35
36
# File 'lib/aspec/formatters/terminal.rb', line 34

def step_pass(step)
  line(green + step_line(step) + reset)
end