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?
Thanks for your tip
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?
Thanks for your tip
Hi,
On 25 Wrz, 21:02, Fernando P. [email protected]
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 ;).
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs