Setting @request.env["HTTP_REFERER"] in an integration test

Hi.

I would like to set @request.env["HTTP_REFERER"] in an integration
test, but due to its nature, I would naturally set this value to the
previousle request url. How do I do that.

Thanks.

Jarl

you can do it like this:

@headers ||= {}
@headers[“HTTP_REFERER”] = “previous_link_url”

get/put/post some_link_url, nil, @headers

hope this would help you.

thanks.

Thanks david.

David Angga <carsmetic.oc@gmail.com> writes:

1. (*) text/plain ( ) text/html

you can do it like this:

@headers ||= {}
@headers["HTTP_REFERER"] = "previous_link_url"

get/put/post some_link_url, nil, @headers

hope this would help you.

Well I got that far my self. My question is "What is the value of the
previous request?" Note: I am talking about an integration test.

So I would expect the previous url to be found in something like this
@response.full_url

Which would make me do like this
@headers["HTTP_REFERER"] = @response.full_url

For now I have made
get/put/post some_link_url, nil, { "HTTP_REFERER" => @request.url }

I think actually that was the value that I was seeking.

I wonder why this is not set automatically in
ActionController::Integration::Session#get
ActionController::Integration::Session#put
ActionController::Integration::Session#post

Jarl