开发者

Specify host for Rails functional tests

开发者 https://www.devze.com 2022-12-16 13:29 出处:网络
S开发者_C百科ome of my controller actions use the request.host parameter in their logic. In integration tests I can use the host! method to set the host. How can the same be achieved in functional tes

S开发者_C百科ome of my controller actions use the request.host parameter in their logic. In integration tests I can use the host! method to set the host. How can the same be achieved in functional tests?


Found my own solution:

def setup
  @request.host = 'test.example.com'
end

The @request object is reused between requests, so it only has to be set once.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号