test: configure default host on APP_HOST everywhere

This commit is contained in:
Colin Darie 2024-03-27 09:06:42 +01:00
parent 2ea45d5dba
commit 863784a1a9
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
3 changed files with 6 additions and 6 deletions

View file

@ -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
}

View file

@ -25,7 +25,7 @@ describe MailTemplateConcern do
it do
expected =
"[demarches-simplifiees.fr] #{dossier.id} #{dossier.procedure.libelle} " +
"<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}\">http://localhost:3000/dossiers/#{dossier.id}</a>"
"<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}\">http://test.host/dossiers/#{dossier.id}</a>"
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("<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}/attestation\">http://localhost:3000/dossiers/#{dossier.id}/attestation</a>") }
it { is_expected.to eq("<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}/attestation\">http://test.host/dossiers/#{dossier.id}/attestation</a>") }
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("<a target=\"_blank\" rel=\"noopener\" href=\"http://localhost:3000/dossiers/#{dossier.id}/attestation\">http://localhost:3000/dossiers/#{dossier.id}/attestation</a>") }
it { is_expected.to include("<a target=\"_blank\" rel=\"noopener\" href=\"http://test.host/dossiers/#{dossier.id}/attestation\">http://test.host/dossiers/#{dossier.id}/attestation</a>") }
it { is_expected.to_not include("Télécharger le justificatif") }
end

View file

@ -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