Skip to content

Instantly share code, notes, and snippets.

@bltavares bltavares/README.md forked from spicycode/README.md
Created Jul 8, 2011

Embed
What would you like to do?
Yelly the Yellingist Formatter there ever was

YELLY!!!!! THE YELLINGIST FORMATTER EVER!!!!!

Yelly likes to yell. To make the magic happen for simple cases just invoke him ala:

bundle exec rspec --require=./yelly_the_yellingist_formatter.rb --format=YellyTheYellingistFormatter spec/models/your_file_here_spec.rb

In closing, >:O

On Linux, require esddsp (from esd) and festival

require 'rspec/core/formatters/documentation_formatter'
class YellyTheYellingistFormatter < RSpec::Core::Formatters::DocumentationFormatter
def example_passed(example)
dabble_in_that_which_should_not_be_dabbled('yes!', example)
super(example)
shout!('yes!', example)
end
def example_failed(example)
dabble_in_that_which_should_not_be_dabbled('no!', example)
super(example)
shout!('no!', example)
end
def example_pending(example)
dabble_in_that_which_should_not_be_dabbled('meh', example)
super(example)
shout!('meh', example)
end
private
def dabble_in_that_which_should_not_be_dabbled(say_what_now, example)
example.metadata[:description] = "#{say_what_now.upcase} - #{example.metadata[:description]}"
end
def shout!(say_what_now, example)
if you_got_the_pipes?
system("say", say_what_now)
elsif you_got_linux_pipes?
system("echo \"#{say_what_now.gsub /!/, ""}\" | esddsp festival --tts")
end
end
def you_got_the_pipes?
@pipes_present ||= system('which say > /dev/null 2>&1')
end
def you_got_linux_pipes?
@linux_pipes_present ||= system('which festival > /dev/null 2>&1') && system("which esddsp > /dev/null 2>&1")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.