Functional tests don't detect that locals are not passed

I have quite a strange problem: there was a bug in my code where I
forgot to pass a local variable to a partial. This problem was not
detected by my functional tests although it lead to a
ActionView::TemplateError: undefined local variable or method
in my development (and unfortunately production) environment.
After digging deeper, I noticed that the functional test fails as
expected when it is executed without the other tests (using the -n
option). But when running all tests of the whole controller, the test
passes. I suspect the test-environment to somehow cache the partial
(it is also called by other tests) and thus played around with the
config.action_controller.perform_caching and
config.action_view.cache_template_extensions parameters, but without
success.
Does anybody have an idea where the problem comes from and how I can
fix it? When I can't trust my tests anymore, I am really stuck...

Thanks,
  Mats

I have quite a strange problem: there was a bug in my code where I
forgot to pass a local variable to a partial. This problem was not
detected by my functional tests although it lead to a
ActionView::TemplateError: undefined local variable or method
in my development (and unfortunately production) environment.

After digging deeper, I noticed that the functional test fails as
expected when it is executed without the other tests (using the -n
option). But when running all tests of the whole controller, the test
passes. I suspect the test-environment to somehow cache the partial
(it is also called by other tests) and thus played around with the
config.action_controller.perform_caching and
config.action_view.cache_template_extensions parameters, but without
success.

This sounds familiar, there have been the odd option touching on these
recently. What you are seeing is an artefact of how :locals is
implemented, and it's not something that can be turned on or off (and
it's not specific to the test environment).
There are some threads that have touched on it:
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/fab600c00f4d076/d186056818da1aa5?lnk=gst&q=locals#d186056818da1aa5
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/1f61a859c16ae533/2dad09e1bf7d754d?lnk=gst&q=locals+defined#2dad09e1bf7d754d

Fred