Has anyone found that in the testing framework, when an action is redirected to itself within a test, ivars that were set the first time through the action REMAIN SET the second time through the action (after the redirect)? I'm getting this behavior in Rails 1.2.1...seems like a bug. For reference, the redirect is supplying different GET parameters than were passed in the first time, so it's not redirecting in some endless loop or anything. Thanks.
on 2007-02-16 01:40
on 2007-02-18 15:33
On 2/16/07, Jon <firstname.lastname@example.org> wrote: > > Thanks. Hi Jon, Is this a functional or integration test? For functional tests, you would presumably be creating the controller instance in #setup, which means you only get a fresh instance per test, and so if you run through the same action twice in one test, the instance variables would be lying around from the previous one. It seems like a strange set up you've got there, though, where not only are you redirecting to the same action, but it acts differently depending on whether or not an instance variable has already been set to something. I can only guess, but maybe it would be better to refactor that a little? Regards, George.