Running minitest with zeus

Since minitest is supposed to be the new default in Rails 4, and I am really
fund of it I recently switched a pet project of mine over. One problem I ran
into was using zeus to speed up my test flow. So there are a couple of things to
look out for when using zeus with minitest-rails.

Rake and zeus don’t match

In most cases when using minitest people will run their tests via rake. This
actually makes a lot of sense normally since rake offers even a special test
task for it, but with zeus we have a different story here. Since rake will
actually load in the environment when running the tests, you don’t actually get
a lot of benefits when running via zeus, so make sure you run your tests via the
provided test task from zeus, which is base on m.

My tests run twice?

Minitest installs a test runner, at the exit hook of the ruby process, so your
tests will run, and then they run on exit again. This is weird, and should only
happen when autorun is required but somewhere deep in rails this is done, so you
need to make sure it doesn’t happen. There is a nice discussion around this
issue with some proposed fixes here
as well as a pull request by me.

So here you go enjoy minitest and zeus

Using zeus without rails

At the last rubyshift the question came up if
zeus could be used without rails, and how to do
it. At the time I kind of expected it to be but wasn’t sure if there are any
complexities which I didn’t see at the moment because I never tried it. So
trying it out it actually works allmost as expected, the only thing needed is a
modification to the custom_plan.rb file which defines how the preloading
actually works. So just as a quick example I
setup a repository which
defines 2 tasks

$ zeus rake
$ zeus foo

This should get everybody started, as the tasks are pretty obvious and easily
modified for your needs.