Railsters:
Despite Rails being the only Web platform designed for TDD, a lot of its
test
infrastructure is still “cargo cult” - imitating other test rigs instead
of
understanding their principles.
Most importantly, tests should run instantly. There’s no excuse for
breaking
this rule, and if you invent a platform that can’t obey it then you are
doing
something wrong. And I have yet to meet a combination of editor and test
script
which does this. Even Visual Studio and C++ are faster and easier to
work with.
The Rails problem is apparently rake db:test:prepare, which clones your
database
instead of detecting whether it needs a clone.
I have heard the fix is ZenTest’s autotest. This allegedly loads the
Ruby “VM”
once, awaits file changes, and responds correctly to each one.
So I have a vanilla Rails 2.3.2 application, and I install autotest (and
autotest -v does not work, so I can’t see which version number I
actually get),
and the gem system claims I have version 4.1.3. And I run autotest in
the
project folder, and it says:
$ autotest
(Not running features. To run features in autotest, set
AUTOFEATURE=true.)
/usr/bin/ruby1.8 -I.:lib:test -rubygems -e “%w[test/unit
test/test_helper.rb].each { |f| require f }” | unit_diff -u
Loaded suite -e
Started
Finished in 0.000437 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
Note the system did not even run the whole test batch, first. And note
it sees
and warns that it rejects my features folder. I need it to see my test
folder
(NOT a spec folder!).
Then I make a non-trivial change to a correctly-named test file, save
the file,
and nothing triggers. (Pure Ubuntu Linux substrate, BTW.)
So how do I trigger?
If I could get that working, how can I TDD both story and unit tests AT
THE SAME
TIME, without using two different test runners?
–
Phlip