Prettier MiniTest for Ruby 1.9 Apr 5

The default test library in Ruby 1.9 is now MiniTest, and Test::Unit is now a wrapper around MiniTest. Here’s the snippet from the Ruby 1.9 release notes:

    * minitest
          o Our new testing library which is faster, cleaner and easier
	    to read than the old test/unit.
          o You can introduce the old test/unit as testunit gem through
            RubyGems if you want.

The problem with both the old and new ruby test libraries is that long running tests withheld error/failure information until the whole suite finished. Turn helped solved this, but it doesn’t have a runner for minitest – the turn codebase has a TODO note to implement a minitest runner though.

I decided to look at minitest and implement a hackish turn-like printer. It’s ugly, but I like the results. This gist is what I came up with. If someone knows how turn’s internal works, I would love to patch something into turn for minitest. I’ve only glanced at turn’s codebase, so I don’t know too much about it.

Anyways, copy the gist your test_helper.rb and you’re all set! It requires you have the ansi gem installed. This is what it looks like in my terminal:

Grab the code here: