Rails Testing ivar bug

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 2/16/07, Jon [email protected] 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs