Stack Too Deep

I am using

redirect_to :back for my login form. It works perfectly.

However when I ran some tests I got errors.

No HTTP_REFERER was set in the request to this action,so redirect_to
:back could not be called successfully. If this is a test, make sure to
specify request.env[“HTTP_REFERER”]

So I replaced all of my :back with request.env[“HTTP_REFERER”] in my
controller. Now I get another error

stack level too deep

What can I use that will work the same as :back but pass tests.

I tried request.env_table[“REQUEST_URI”] which passes the test but fails
my application because it does not work the same way as :back

Thanks you for your time.

Mitch

Hey Mitch,

Check this out
http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html
.

Best.
Mike

On 8 Jul 2008, at 13:59, Mitchell G. wrote:

to
specify request.env[“HTTP_REFERER”]

I think what this means is that in the setup of your test you should
set what the referer is (ie @request.env[“HTTP_REFERER”] =
"http://something.example.com
" )

Fred

Michael B. wrote:

Hey Mitch,

Check this out
http://rubynugs.blogspot.com/2007/02/testing-redirectto-back-shortcut.html
.

Best.
Mike

Thanks Mike exactly the problem and the solution

Frederick C. wrote:

On 8 Jul 2008, at 13:59, Mitchell G. wrote:

to
specify request.env[“HTTP_REFERER”]

I think what this means is that in the setup of your test you should
set what the referer is (ie @request.env[“HTTP_REFERER”] =
"http://something.example.com
" )

Fred

Thank you Fred I will set it and forget it.

Cheers,

Mitch