class EmojiFormatter

Constants

PROGRESS_ICONS

Public Class Methods

new(output) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 14
def initialize(output)
  @output = output
end

Public Instance Methods

dump_failures(notifications) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 34
def dump_failures(notifications)
  @output << "\n\n"

  notifications.failure_notifications.each_with_index do |notification, i|
    data = { i: i + 1, desc: notification.description }
    @output << "%4<i>s) %<desc>s\n" % data
    @output << "      `bundle exec rspec #{notification.example.location_rerun_argument}`\n\n"

    notification.colorized_message_lines.each do |line|
      @output << "      #{line}\n"
    end

    notification.colorized_formatted_backtrace.each do |line|
      @output << "      #{line}\n"
    end

    @output << "\n\n"
  end
end
dump_summary(summary) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 54
 def dump_summary(summary)
   final_stats = "#{summary.examples.count} examples:\
#{summary.failed_examples.count} #{PROGRESS_ICONS[:example_failed]}   \
#{summary.pending_examples.count} #{PROGRESS_ICONS[:example_pending]} "
   @output << final_stats
   puts "" # without this we get a % at the end of the output...
 end
example_failed(_) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 26
def example_failed(_)
  example_result(:example_failed)
end
example_passed(_) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 22
def example_passed(_)
  example_result(:example_passed)
end
example_pending(_) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 30
def example_pending(_)
  example_result(:example_pending)
end
start(_) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 18
def start(_)
  @output << "\n"
end

Private Instance Methods

example_result(type) click to toggle source
# File lib/emoji_formatter/formatter.rb, line 63
def example_result(type)
  string = PROGRESS_ICONS[type]
  @output << "#{string} "
end