🕷 zenspider.com

by ryan davis

Looking for the Ruby Quickref?

PLEASE try out miniunit 1.2

Published 2008-06-07 @ 23:47

Tagged rails, ruby, Seattle.rb, zentest

I’ve been putting a LOT of effort into getting miniunit (still needs a better name… c’mon ppl!) flushed out and polished. This is the release I think is finally ready to replace test/unit in 1.9, but I need your feedback to know how it is. You can help by installing the gem and flipping it on:

  % sudo gem install miniunit
  % sudo use_miniunit yes

The second command will install symlinks into your sitelib directory. That comes before the stdlib dir in $LOAD_PATH so it’ll take over for test/unit. You can roll it out by providing “no” as an argument instead. It should be totally easy and safe.

I’ve added a lot of really great stuff in this release. The biggies:

  • New useful assertions like assert_includes.
  • A refute mirrors every assert. eg refute_empty ary
  • I added mini/spec and mini/mock and they can work side-by-side with mini/test.

One of the things I did was put a lot of effort into making it work with abusive frameworks like rails (they do bad things to test frameworks). But we used the rails tests in very particular ways, so I don’t know if there are other ways that don’t work with miniunit.

One thing I’m proud of: Even with all the extra assertions, the spec framework, the mock framework, I still blow test/unit away. Check it:

   lib  loc     641 total
   test loc     905 total
   totl loc    1546 total
   flog = 707.623602773533
   lib  loc    3571 total
   test loc    2464 total
   totl loc    6035 total
   flog = 3103.27739878118

Rad eh?

So, install it and take it for a spin. Report bugs on rubyforge.

NOTE: Do not report bugs against it if you’re trying to use it integrated into a GUI IDE/test-runner like komodo. It isn’t meant to be compatible with GUI runners and the like. It is meant to be compatible with your tests.