Emilio T. wrote:
$ruby test/functional/registrations_controller_test.rb
next, try:
$ruby test/functional/registrations_controller_test.rb -n
test_one_specific_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.
–
Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax