I started this on the core mailing list, but I thought I'd open an issue too.
I'm trying to do a patch for Ticket #5369
I am working with the 1-2-stable branch. I was trying to add a test
that adds validates_associated to the Reply model and goes for a false
valid?. I discovered that it would only fail properly if I prepended
000 to the name so it would run early in the list of tests. I tracked
down the problem to several tests adding various validations to the
models. These validations are persistant across tests.
Here's what the validations of the Reply model look like during my
test if I run my test at the begininning of the suite:
(rdb:1) pp validations
[#<Proc:0xb78d3e68@./../lib/active_record/validations.rb:296>,
:errors_on_empty_content,
:validate_associated_records_for_replies]
And here's what they look like if I break in the same test with only
the name modified so it runs in the middle of the pack.
(rdb:1) pp validations
[#<Proc:0xb78c9e68@./../lib/active_record/validations.rb:296>,
#<Proc:0xb78bda14@./../lib/active_record/validations.rb:407>,
#<Proc:0xb78c9e68@./../lib/active_record/validations.rb:296>,
#<Proc:0xb78c9e68@./../lib/active_record/validations.rb:296>,
:errors_on_empty_content,
:validate_associated_records_for_replies]
As you can see it has gathered a couple more validations from tests
running in the first half of the suite.
I added some code to the setup method to reload the model classes used and uncovered some tests that depended on others running first to pass correctly. I corrected all of the tests that had problems after my modification. I'm not sure if the way I reload the models is the cleanest as I'm a ruby noob, but I thought I'd share it just in case it was useful.