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.
As of late 2023 the accepted answer no longer works. The following, however, does.
require "minitest"
Minitest.load_plugins
require "minitest/pride"
Include the above code in e.g. test/test_helper.rb
, or in wherever you put code common to all of your tests. This will give you test runs that look similar to this: