This post originated from an RSS feed registered with Ruby Buzz
by Ryan Davis.
Original Post: rake passes but autotest fails?
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
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:
rake:
ruby -e "require 'test_a'; require 'test_b'; ..."
autotest:
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.