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:
parent
097470bb0c
commit
5b89f64eaf
4 changed files with 21 additions and 5 deletions
|
|
@ -117,6 +117,11 @@ RSpec.configure do |config|
|
|||
# end
|
||||
# end
|
||||
|
||||
# Expect configured host instead of `test.host` (see https://stackoverflow.com/q/15414847)
|
||||
config.before(:each, type: :controller) do
|
||||
@request.host = Rails.application.routes.default_url_options[:host]
|
||||
end
|
||||
|
||||
# use the config to use
|
||||
# t('some.locale.key') instead of always having to type I18n.t
|
||||
config.include AbstractController::Translation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue