Skip to content

Instantly share code, notes, and snippets.

@nbibler
Last active December 8, 2016 16:38
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 nbibler/09f70fc3face5158359c5638239103cd to your computer and use it in GitHub Desktop.
Save nbibler/09f70fc3face5158359c5638239103cd to your computer and use it in GitHub Desktop.
Passed: 🎄, Pending: 🎀, Failed: 🎁
# bundle exec rspec --require ./christmas_formatter.rb --format ChristmasFormatter
require "rspec/core/formatters/base_text_formatter"
require "rspec/core/formatters/console_codes"
class ChristmasFormatter < RSpec::Core::Formatters::BaseTextFormatter
RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed, :start_dump
FAIL_EMOJI = "\u{1f381}"
PASS_EMOJI = "\u{1f384}"
PENDING_EMOJI = "\u{1f380}"
def example_passed(*)
output.print RSpec::Core::Formatters::ConsoleCodes.wrap(PASS_EMOJI, :passed)
end
def example_pending(*)
output.print RSpec::Core::Formatters::ConsoleCodes.wrap(PENDING_EMOJI, :pending)
end
def example_failed(*)
output.print RSpec::Core::Formatters::ConsoleCodes.wrap(FAIL_EMOJI, :failure)
end
def start_dump(*)
output.puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment