Missing host to link to! Please provide :host parameter or set default_url_options[:host] (ActionView::Template::Error)

心已入冬 提交于 2020-01-10 22:17:30

问题


I installed devise and added config.action_mailer.default_url_options = { :host => 'localhost:3000' } to my development.rb file as suggested. When I run cucumber I get an error:

Missing host to link to! Please provide :host parameter or set default_url_options[:host] (ActionView::Template::Error)

does anyone know what this is related to? not too much info on google about this


回答1:


Cucumber runs your test environment so you need to add the very same line in test.rb.




回答2:


For posterity, in case it has nothing to do with mailers but you still get the Missing host error while running capybara, rspec...

If you are using url helpers in your tests and have included somewhere in your rspec config:

config.include Rails.application.routes.url_helpers

Then, you should also add something along this line to the same config:

Rails.application.routes.default_url_options[:host] = "test.host"


来源:https://stackoverflow.com/questions/7366746/missing-host-to-link-to-please-provide-host-parameter-or-set-default-url-optio

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