English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

Color Output with Test:Unit, AutoTest and Ruby 1.9


If you are testing using Test:Unit (rather than RSpec) and you're using Ruby 1.9.* colorized output of your tests using Autotest will not be immediately available. Since, 1.9 comes with mini test the test/unit/ui/console/testrunner.rb script is not loaded and not available and will break your tests.

The solution is to require Test:Unit version 2.0.0 in your Gemfile, require the testrunner.rb script in test/test_helper.rb and reopen and implement the guess_color_availability method.

require 'test/unit/ui/console/testrunner'

class Test::Unit::UI::Console::TestRunner
    def guess_color_availability 

group :development, :test do
    gem "minitest", "~> 2.10.0"
    gem "turn", "~> 0.8.3"
    gem 'test-unit', '~> 2.0.0'  
    gem 'autotest-rails'

Then you can just run the autotest command (or bundle exec autotest) from your project directory. When you save a file your tests will be run for the file that has been changed and the results will be fully colorized!

Tagged w/ #autotest #color #hacks #ruby #tdd #testing #tools #workarounds #workflowruby #ruby on rails