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.
See https://github.com/tenderlove/purdytest/issues/1. It seems to be a known bug with the minitest version shipped with 1.9.2. For the others, adding
at the very top of your file did the trick.
Give turn a whirl.
Add this to your Gemfile:
simply add these lines to your test_helper.rb file after require 'rails/test_help'
in your gemfile add
this will get your rake test to be in red and green, but it also brings up the backtrace. to get rid of all those extra backtrace logs add this to your gemfile then bundle:
then in config/initializers/backtrace_silencers.rb add this line to cut all the extra rvm stuff
hope that works for you, let me know if you need more details.
I currently use
purdytest
with 1.9.2Try look at this post about using turn gem for nice looking and configurable output for minitest. http://rawonrails.blogspot.com/2012/01/better-minitest-output-with-turn-gem.html
redgreen and turn work nicely in conjunction with each other, by the way