Created
December 17, 2010 05:31
-
-
Save mipearson/744527 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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