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.

On Thu, Aug 27, 2009 at 8:02 PM, Jarl F. [email protected] wrote:


David A. Prasetya
Ruby on Rails developer
@ http://kiranatama.com - a Ruby on Rails outsourcing company

Thanks david.

David A. [email protected] 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

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