Forum: Ruby on Rails Rails Testing ivar bug

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
71c90d30f8c437a593aeb5588408ec1a?d=identicon&s=25 Jon (Guest)
on 2007-02-16 01:40
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

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.

C515daf003a781a638d8a01e41a935a0?d=identicon&s=25 George Ogata (Guest)
on 2007-02-18 15:33
(Received via mailing list)
On 2/16/07, Jon <> 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?

This topic is locked and can not be replied to.