gpt4 book ai didi

ruby-on-rails - rspec 失败 "Missing host to link to!..."

转载 作者:数据小太阳 更新时间:2023-10-29 08:20:20 33 4
gpt4 key购买 nike

我目前遇到以下错误:

 1) Organization.invite_user should create a new user for a specific orgs initial user
Failure/Error: organization.invite_user(second_email)
ActionView::Template::Error:
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
# ./app/views/devise/mailer/reset_password_instructions.html.erb:5:in `_app_views_devise_mailer_reset_password_instructions_html_erb___4480543240081585515_70131221479860'
# ./app/models/organization.rb:34:in `invite_user'
# ./spec/models/organization_spec.rb:24:in `block (3 levels) in <top (required)>'

有人知道 rspec 中会发生什么吗?

最佳答案

在您的 config/environments/test.rb 文件中,您应该提供以下配置:

config.action_mailer.default_url_options = { host: 'www.example.com' }

用于由 ActionMailer 生成的链接

关于ruby-on-rails - rspec 失败 "Missing host to link to!...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22501116/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com