Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
emoji_spec is a microgem to put emoji in your rspec output.

Emoji Spec

results Tired of the same, dull rspec output? liven it up with some emoji!

Below are the sets presently available, and their corresponding id. if you don't set an ID, one will be randomly chosen every run. Emoji icons may not render in certain terminals.

(pass, fail, pending)

emoji

Installation

put it in your gemfile, under the test group.

  gem 'emoji_spec', :git => "https://gist.github.com/6112257.git"

Usage

Trying it out

Formatter

pass the formatter option in when you run the rspec command, like so

$ rspec spec --format EmojiFormatter

Specify Emoji group

to pick a specific set, set the enviroment variable EMOJI_SPEC like so

$ EMOJI_SPEC=1 rspec spec/

you can also do

$ export EMOJI_SPEC=1 

to set it for this terminal session

Setting for good

Formatter

create or edit .rspec in your project directory and add --format EmojiFormatter to it.

Specify Emoji group

A few ways to do this, the easiest is to edit your ~/.bash_profile and add export EMOJI_SPEC=1

# encoding: UTF-8
require 'rspec/core/formatters/base_text_formatter'
class EmojiFormatter < RSpec::Core::Formatters::BaseTextFormatter
EMOJILIB = [
["๐Ÿ˜ƒ","๐Ÿ˜ก","๐Ÿ˜ฐ"],
["๐Ÿ’š","๐Ÿ’”","๐Ÿ’™"],
["๐Ÿ˜","๐Ÿ˜ญ ๐Ÿ”ซ","๐Ÿ˜ฉ"],
["๐Ÿ‘","๐Ÿ‘Ž","๐Ÿ‘‹"],
["๐ŸŒ","๐ŸŒš","๐ŸŒ“"],
["๐Ÿฉ","๐Ÿฅ","๐Ÿซ"],
["๐Ÿฐ","๐Ÿ’ฉ","๐ŸŽƒ"],
["๐Ÿ†—","โ›”","โ”"],
["๐Ÿ™†","๐Ÿ™","๐Ÿ™‹"],
["๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“Š"],
["โšช","๐Ÿ”ด","๐Ÿ”ต"],
["๐Ÿ™ˆ","๐Ÿ™Š","๐Ÿ™‰"],
["๐Ÿบ"," F-๐Ÿ’ฃ","๐Ÿ”ฎ"],
["๐Ÿ˜ธ", "๐Ÿ˜พ", "๐Ÿ™€"],
["๐ŸŒบ","๐Ÿ’ฉ","๐Ÿ‘ƒ"],
["๐Ÿผ","๐Ÿด","๐Ÿ˜"],
["๐Ÿ","๐ŸŽ","๐Ÿ‹"]]
# pass in EMOJI_SPEC at command line to set specific collection; random otherwise.
length= EMOJILIB.size - 1
val = (!ENV["EMOJI_SPEC"].nil? && ENV["EMOJI_SPEC"].to_i - 1) || [*0..length].sample
EMOJI = EMOJILIB[val]
puts "Using emoji set: #{(val + 1).to_s}"
puts "Pass: #{EMOJI[0]} / Fail: #{EMOJI[1]} / Pending: #{EMOJI[2]}"
def example_passed(example)
super(example)
output.print(self.class::EMOJI[0] + " ")
end
def example_pending(example)
super(example)
output.print(self.class::EMOJI[2] + " ")
end
def example_failed(example)
super(example)
output.print(self.class::EMOJI[1] + " ")
end
end
Gem::Specification.new do |s|
s.name = 'emoji_spec'
s.version = '0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Russell Jennings'
s.email = 'russell@novafabrica.com'
s.summary = 'Emoji in your rspec output'
s.description = 'Replaces the boring textual representations of spec results with EMOJI.'
s.files = ['emoji_formatter.rb']
s.require_path = '.'
s.add_development_dependency('rspec', ["~> 2.0"])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.