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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-31 19:41 UTC
Re: Functional tests don''t detect that locals are not passed
On Jul 31, 8:22 pm, Mats <dez...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---