Colorful RSpec Stories

I do not know why there are no colors in the stories, but here is a small monkeypatch to fix this… (setting option[color] and not overwriting them would be better, but i could not find where to set them…)

#vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb line ~50
#COLORIZE!
@options.colour = true#HACK
out = "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
if @failed_scenarios.size > 0
  out = red(out)
else 
  if @pending_scenario_count > 0
    out = yellow(out)
  else
    out = green(out)
  end
end
@output.puts out 
#COLORIZE! END
#@output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"

Enjoy the colors 😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s