Last active
February 6, 2023 13:18
-
-
Save dinks/99b1c80cd3677a15c14b to your computer and use it in GitHub Desktop.
Hearts Formatter
This file contains 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
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 |
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
Nice!