class RSpec::Core::Formatters::Unassuming

Attributes

failed_examples[R]
output[R]

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/unassuming/formatter.rb, line 14
def initialize(output)
  @output = output
  super(output)
end

Public Instance Methods

blue(input) click to toggle source
# File lib/unassuming/formatter.rb, line 84
def blue(input)
  wrap(input, :blue)
end
bold(input) click to toggle source
# File lib/unassuming/formatter.rb, line 88
def bold(input)
  wrap(input, :bold)
end
cyan(input) click to toggle source
# File lib/unassuming/formatter.rb, line 92
def cyan(input)
  wrap(input, :cyan)
end
cyan_line() click to toggle source
# File lib/unassuming/formatter.rb, line 80
def cyan_line
  output.puts cyan('--------------------------------------')
end
dump_failure(example, index) click to toggle source
# File lib/unassuming/formatter.rb, line 48
def dump_failure(example, index)
  output.puts
  dump_failure_info(example, index)
end
dump_failure_info(example, index) click to toggle source
# File lib/unassuming/formatter.rb, line 53
def dump_failure_info(example, index)
  exception = example.exception
  message = strip_whitespace(exception.message)
  failed_line = strip_whitespace(read_failed_line(example))
  output.print "#{index+1}) #{cyan failed_line}\t #{red message }"
end
dump_failures(notification) click to toggle source
# File lib/unassuming/formatter.rb, line 41
def dump_failures(notification)
  return if failed_examples.empty?
  failed_examples.each_with_index do |example, index|
    dump_failure(example, index)
  end
end
dump_summary(run) click to toggle source
# File lib/unassuming/formatter.rb, line 60
def dump_summary(run)
  output.puts "\n"
  output.puts "Finished in #{run.duration}\n"
  output.puts "#{run.example_count} examples, #{run.failure_count} failures"
  if run.failure_count > 0
    output.puts bold(red "(╯°□°)╯︵ ┻━┻")
  else
    output.puts bold(magenta "(ノ◕ヮ◕)ノ*:・゚✧")
  end
  cyan_line
end
example_failed(example) click to toggle source
# File lib/unassuming/formatter.rb, line 32
def example_failed(example)
  failed_examples << example
  output.print red('☢')
end
example_passed(example) click to toggle source
# File lib/unassuming/formatter.rb, line 28
def example_passed(example)
  output.print green('好 ')
end
example_pending(example) click to toggle source
# File lib/unassuming/formatter.rb, line 37
def example_pending(example)
  output.print yellow(example)
end
green(input) click to toggle source
# File lib/unassuming/formatter.rb, line 96
def green(input)
  wrap(input, :green)
end
magenta(input) click to toggle source
# File lib/unassuming/formatter.rb, line 108
def magenta(input)
  wrap(input, :magenta)
end
now() click to toggle source
# File lib/unassuming/formatter.rb, line 72
def now
  Time.now.strftime('%H:%M:%S')
end
read_failed_line(example) click to toggle source
# File lib/unassuming/formatter.rb, line 112
def read_failed_line(example)
  example.example.location.split("/").last.to_s
end
red(input) click to toggle source
# File lib/unassuming/formatter.rb, line 100
def red(input)
  wrap(input, :red)
end
start(example_count) click to toggle source
Calls superclass method
# File lib/unassuming/formatter.rb, line 19
def start(example_count)
  super(example_count)
  cyan_line
  output.print(bold('Starting Spec Run @ '), green(now), ' -> ')
  @example_results = []
  @failed_examples = []
  @pending_examples = []
end
strip_whitespace(string) click to toggle source
# File lib/unassuming/formatter.rb, line 76
def strip_whitespace(string)
  string.to_s.gsub("\n", ' ').gsub(/\s{2,}/, ' ')
end
yellow(input) click to toggle source
# File lib/unassuming/formatter.rb, line 104
def yellow(input)
  wrap(input, :yellow)
end