Set default URL host

Setting the default host resolves:

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

Configuring RSpec to use the default host resolves:

    Expected response to be a redirect to <http://test.host/…>
    but was a redirect to <http://localhost/…>.
This commit is contained in:
Andrew Kvalheim 2022-10-27 12:54:35 -07:00
parent 097470bb0c
commit 5b89f64eaf
4 changed files with 21 additions and 5 deletions

View file

@ -43,8 +43,12 @@ Rails.application.configure do
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Set the detault url for action mailer
config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Provide a default host for URLs
Rails.application.routes.default_url_options[:host] = 'localhost:3000'
config.action_controller.default_url_options = Rails.application.routes.default_url_options
config.action_mailer.default_url_options = Rails.application.routes.default_url_options
# Configure outgoing mail
config.action_mailer.delivery_method = :test
config.after_initialize do