Rails Test Environment Named Routes

☆樱花仙子☆ 提交于 2019-12-11 18:07:56

问题


I've noticed that when I run tests (using Rspec and spork, if that matters), my hostname is set to www.example.com. So if I do:

 visit sports_url

the test is actually going to www.example.com/sports.

This is a problem because I need to run some of the tests with selenium (to get javascript support). Also, I noticed my emails where being marked as coming from www.example.com.

What did I mess up? Why is the test environment running as example.com? Can I configure this somewhere? I would assume it should be programatic (depending on what port the test server starts up on).


回答1:


You can configure the test environment domain, then set up DNS to do what you need.

How do I change the default "www.example.com" domain for testing in rails?



来源:https://stackoverflow.com/questions/9694756/rails-test-environment-named-routes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!