diff --git a/config/environments/test.rb b/config/environments/test.rb
index 4a01914e6..3f79b3b0f 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -63,9 +63,9 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.default_url_options = { host: ENV.fetch("APP_HOST") }
Rails.application.routes.default_url_options = {
- host: 'localhost:3000',
+ host: ENV.fetch("APP_HOST"),
protocol: :http
}
diff --git a/spec/models/concern/mail_template_concern_spec.rb b/spec/models/concern/mail_template_concern_spec.rb
index e33adb3d2..965d8432f 100644
--- a/spec/models/concern/mail_template_concern_spec.rb
+++ b/spec/models/concern/mail_template_concern_spec.rb
@@ -25,7 +25,7 @@ describe MailTemplateConcern do
it do
expected =
"[demarches-simplifiees.fr] #{dossier.id} #{dossier.procedure.libelle} " +
- "http://localhost:3000/dossiers/#{dossier.id}"
+ "http://test.host/dossiers/#{dossier.id}"
is_expected.to eq(expected)
end
@@ -75,7 +75,7 @@ describe MailTemplateConcern do
describe "in closed mail without justificatif" do
let(:mail) { create(:closed_mail, procedure: procedure) }
- it { is_expected.to eq("http://localhost:3000/dossiers/#{dossier.id}/attestation") }
+ it { is_expected.to eq("http://test.host/dossiers/#{dossier.id}/attestation") }
it { is_expected.to_not include("Télécharger le justificatif") }
end
@@ -86,7 +86,7 @@ describe MailTemplateConcern do
let(:mail) { create(:closed_mail, procedure: procedure) }
it { expect(dossier.justificatif_motivation).to be_attached }
- it { is_expected.to include("http://localhost:3000/dossiers/#{dossier.id}/attestation") }
+ it { is_expected.to include("http://test.host/dossiers/#{dossier.id}/attestation") }
it { is_expected.to_not include("Télécharger le justificatif") }
end
diff --git a/spec/serializers/procedure_serializer_spec.rb b/spec/serializers/procedure_serializer_spec.rb
index 55eeaa000..919bf53ee 100644
--- a/spec/serializers/procedure_serializer_spec.rb
+++ b/spec/serializers/procedure_serializer_spec.rb
@@ -4,7 +4,7 @@ describe ProcedureSerializer do
let(:procedure) { create(:procedure, :published) }
it {
- is_expected.to include(link: "http://localhost:3000/commencer/#{procedure.path}")
+ is_expected.to include(link: "http://test.host/commencer/#{procedure.path}")
is_expected.to include(state: "publiee")
}
end