Hi,
On 25 Wrz, 21:02, Fernando Perez
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> My app, relies on request.domain to display some data according to the
> domain.
>
> However during RSpec tests, the request.domain is set to
"test.host". Is
> there a way I can manually set it for the test environment?
Yes, you can do that, for example I do it like this:
it "should do something"
request.headers["Host"] = "microsoft.com"
get :index
response.should render_template("public/404.html")
response.headers["Status"].should == "404 Not Found"
end
Not all is required, but you get the idea ;).
> Thanks for your tip
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---