class RspecNumberingFormatter

useful reference: ascii-table.com/ansi-escape-sequences.php

Constants

VERSION

Attributes

run_count[RW]

Public Instance Methods

dump_failures(notification) click to toggle source
# File lib/rspec_numbering_formatter.rb, line 44
def dump_failures notification
  puts
end
example_failed(notification) click to toggle source
# File lib/rspec_numbering_formatter.rb, line 31
def example_failed(notification)
  @run_count += 1
  output.puts "\r\e[K#{@run_count.to_s.rjust(10)} #{notification.example.full_description}"
  output.puts "           #{truncate_cwd notification.example.location}"
  output.puts notification.colorized_message_lines
  output.puts notification.colorized_formatted_backtrace
  output.puts
end
example_passed(notification) click to toggle source
# File lib/rspec_numbering_formatter.rb, line 22
def example_passed(notification)
  elapsed = (Time.now - @start_time).to_i
  secs = elapsed % 60
  mins = elapsed / 60
  elapsed = "#{mins}:#{secs.to_s.rjust(2, '0')}"
  @run_count += 1
  output.print "\r\e[K#{elapsed.rjust(8)} #{@run_count.to_s.rjust(10)} #{notification.example.full_description[0..100].ljust(101)}  #{truncate_cwd(notification.example.location)[0..100]}"
end
failure_color(*args) click to toggle source
# File lib/rspec_numbering_formatter.rb, line 12
def failure_color(*args); red(*args); end
start(notification) click to toggle source
Calls superclass method
# File lib/rspec_numbering_formatter.rb, line 14
def start(notification)
  super
  @cwd = `pwd`
  @start_time = Time.now
  @run_count = 0
  output.puts "#{notification.count} examples"
end
truncate_cwd(str) click to toggle source
# File lib/rspec_numbering_formatter.rb, line 40
def truncate_cwd str
  str.sub @cwd, ""
end