🕷 zenspider.com

by ryan davis

Looking for the Ruby Quickref?

rake passes but autotest fails?

Published 2006-11-06 @ 22:33

Tagged zentest, rails, ruby, Seattle.rb

Fix Your Dependencies!!!

Yipstar finally provided me a producible test case for the situation a number of people have told me about but couldn’t boil down. The whole thing is so dead simple. That is why I think I missed it this whole time:


  ruby -e "require 'test_a'; require 'test_b'; ..."


  ruby -e "...; require 'test_b'; require 'test_a'"

If your tests break by simply changing the order in which they load then you have dependency issues! Every single test file you have should be able to run independently of all others (which is a damn powerful tool to have in combination with -n "/regex/").

(As an aside, I worked with yipstar and we got his tests all patched up and autotest still had a problem because it uses load, not require… no clue… Eric and I are going to look into that tomorrow)

Some of you will want me to “fix autotest”… BAH! Autotest isn’t broken! Your tests are! I will add another task to Hoe that will help point out all test files that don’t pass independently so you can go and patch up your tests.

  % rake test_deps
  Dependency Issues: test/test_a.rb
  Dependency Issues: test/test_c.rb

We should have a release later today for both ZenTest and Hoe with new testy goodness.