Jarl Friis
2009-Aug-27 13:02 UTC
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
David Angga
2009-Aug-27 14:18 UTC
Re: Setting @request.env["HTTP_REFERER"] in an integration test
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 Friis <jarl-VtTiYveqpzg@public.gmane.org> wrote:> > 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 > > > > > > >-- David Angga Prasetya Ruby on Rails developer @ http://kiranatama.com - a Ruby on Rails outsourcing company --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jarl Friis
2009-Aug-28 06:38 UTC
Re: Setting @request.env["HTTP_REFERER"] in an integration test
Thanks david. David Angga <carsmetic.oc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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