Skip to content

Instantly share code, notes, and snippets.

@dinks
Last active February 6, 2023 13:18
Show Gist options
  • Save dinks/99b1c80cd3677a15c14b to your computer and use it in GitHub Desktop.
Save dinks/99b1c80cd3677a15c14b to your computer and use it in GitHub Desktop.
Hearts Formatter
require 'rspec/core/formatters/base_text_formatter'
# Custom Rspec formatter
# bundle exec rspec --require ./hearts_formatter.rb --format HeartsFormatter
#
class HeartsFormatter < RSpec::Core::Formatters::BaseTextFormatter
DOT_SUCCESS = "💚"
DOT_PENDING = "💛"
DOT_FAILURE = "💔"
def example_passed(_notification)
output.printf "%2s", DOT_SUCCESS
end
def example_pending(_notification)
output.printf "%2s", DOT_PENDING
end
def example_failed(_notification)
output.printf "%2s", DOT_FAILURE
end
end
RSpec::Core::Formatters.register HeartsFormatter, :example_passed, :example_failed, :example_pending
@pixelpogo
Copy link

Nice!

@awendt
Copy link

awendt commented Feb 24, 2015

I'd expect to see this in a PR, not a gist 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment