How to color unit tests with lib minitest or Test:Unit?

poseid picture poseid · Jul 7, 2011 · Viewed 12.4k times · Source

I would like to have unit tests output color in my dev environment. However, I can't make it work on Linux (Debian and Ubuntu). When I include the following libs:

require 'minitest/autorun'
require 'minitest/unit'
require 'minitest/pride'

I get:

/usr/local/rvm/gems/ruby-1.9.2-p136/gems/minitest-2.3.1/lib/minitest/pride.rb:35:in `<top (required)>': undefined method `output' for MiniTest::Unit:Class (NoMethodError)

caused by the code:

MiniTest::Unit.output = PrideIO.new(MiniTest::Unit.output)

I have seen a working Rspec variant. Unfortunately, my Ruby knowledge is not enough to see differences.

Answer

Colin Dean picture Colin Dean · Oct 4, 2011

Give turn a whirl.

Add this to your Gemfile:

group :test do
  gem 'turn', :require => false
end