What the? 4
Wow:
$ rake spec ... 156 examples, no failures $ ./script/spec spec ... 156 examples, 2 failures $ rake [unit tests, all pass] [functional tests, all pass] [specs...] 156 examples, 2 failures
For extra points, the 2 failures from running the plain rake are not the same as the failures from running ./script/spec spec. And if I run ./script/spec spec after a full rake run, I get a host of extra failures.
I wonder what I’m doing to so comprehensively screw up test isolation.
Ho hum.

Piers, trust me: is not you.
I get the same issues with rake spec (which uses spec/spec.opts)
Try doing ./script/spec using the same options from that file and see what happens.
Rake mess up the whole environment and loading of things somehow. Using with rake sometimes give me faulty specs, and sometimes the opposite…
I know Windows could be the problem, but so much? ;-)
I’m pretty sure it’s related to fixture loading, but I haven’t yet worked out how to get things into a good state.
Does Rake run the tests in (a) separate interpreter(s)?
Each set of tests gets run in its own interpreter, so
test:unitsgets one interpreter,test:functionalsgets another andspecgets a third.I think the issue is related to the problem I worked around by turning off transactional fixtures in the tests. This means that the database isn’t in a pristine state when the specs start up. I assume that the problem with
rake specand./script/spec specfailing in different places is that they run the specs in a different order, which means they trip over the database issue earlier.I’m not going to complain too hard though – fixing it has fixed at least one latent bug in Typo.