Skip to content

Instantly share code, notes, and snippets.

@mipearson
Created December 17, 2010 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mipearson/744527 to your computer and use it in GitHub Desktop.
Save mipearson/744527 to your computer and use it in GitHub Desktop.
# See https://github.com/dchelimsky/rspec/wiki/Custom-Formatters for info on how to use custom formatters in rspec 1.x
require 'spec/runner/formatter/progress_bar_formatter'
class ProgressEmoFormatter < Spec::Runner::Formatter::ProgressBarFormatter
@@num_consecutive_failures = 0
FAILURES_BEFORE_EMO = 4
def example_failed(example, counter, failure)
@@num_consecutive_failures += 1
letter = @@num_consecutive_failures > FAILURES_BEFORE_EMO ? 'U' : 'F'
@output.print colorize_failure(letter, failure)
@output.flush
end
def example_passed(example)
super
@@num_consecutive_failures = 0
end
def example_pending(example, message, deprecated_pending_location=nil)
super
@@num_consecutive_failures = 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment