Just do IT

思うは招く

devise gem のメール認証テストで Missing host to link to! Please provide the :host parameter エラー

問題

Devise のメール認証のシステムスペックを書いていたときに以下のエラーが出た。

ActionView::Template::Error:
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

解決

config/environments/test.rb にホストの情報を追記する。

config.action_mailer.default_url_options = { host: "localhost", port: 3000 }