I imagine this could have something to do with test data. Check that
all the require fixtures are included in your controller test. The
data may be being loaded in other tests - hence the passes when you
run the whole suite.
I solved the problem adding missing fixtures as Steve told me, but
hey! wait a second!, this means that i always have to test my
functional tests after doing a ""complete"" test?
My conclusion is that some fixtures gets cached somewhere after
running my unit tests, that shouldn't happen.
You are likely using fixtures, right? If you look at the fixtures loaded for your RegistrationsControllerTest, be sure that all the fixture expectations are listed in that file. I've run into this very problem before. There are some who will recommend all fixtures be listed in the test_helper.rb, but I think that's just an excuse not to stop and think about which fixtures you really *need* for a test.
I solved the problem adding missing fixtures as Steve told me, but
hey! wait a second!, this means that i always have to test my
functional tests after doing a ""complete"" test?
I interpret this to mean "each time I change any test, must I run all
the tests independently to verify they isolate correctly?"
The general answer is no - testing the tests is the road to madness.
Your production code never had a bug here, and tests should fail
_more_easily_ than production code gets bugs.
However, yes, each time you add a fixture to a test case you risk
breaking test isolation with other test cases. A good way to catch
this is test with rake test:recent or rake test:svn_modified, each
time you change the code. That way, as you change different
combinations of test cases, you get to see if they (apparently)
isolate from each other, independent of the group. Many a Rails
application can no longer run a partial test because only the total
test worked when they integrated.
My conclusion is that some fixtures gets cached somewhere after
running my unit tests, that shouldn't happen.
Yes, in the database. (-;
Is this meant to be this way or it's a bug?
You are lucky to have test fixtures. Some systems make them so slow,
their programmers must avoid database calls in most tests! So any
residual optimizations here are generally to your benefit. Perfect
test isolation would restart and rebuild the database between each
test run. We rely on less than perfect isolation in exchange for
speed.