fix(mailers): hardcode default url options host because APP_HOST is not yet migrated
This commit is contained in:
parent
69a4ca668b
commit
2f1b1ba5fe
|
@ -57,7 +57,7 @@ module MailerDefaultsConfigurableConcern
|
|||
|
||||
def set_currents_for_demarches_gouv_fr
|
||||
Current.application_name = "demarches.gouv.fr"
|
||||
Current.host = ENV.fetch("APP_HOST")
|
||||
Current.host = "demarches.gouv.fr"
|
||||
Current.contact_email = "contact@demarches.gouv.fr"
|
||||
Current.no_reply_email = NO_REPLY_EMAIL.sub("demarches-simplifiees.fr", "demarches.gouv.fr") # rubocop:disable DS/ApplicationName
|
||||
end
|
||||
|
|
|
@ -57,8 +57,8 @@ RSpec.describe DeviseUserMailer, type: :mailer do
|
|||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to eq("Ne pas répondre <ne-pas-repondre@demarches.gouv.fr>")
|
||||
expect(header_value("Reply-To", subject.message)).to eq("Ne pas répondre <ne-pas-repondre@demarches.gouv.fr>")
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST")}/users/confirmation")
|
||||
expect(subject.message.to_s).to include("//#{ENV.fetch("APP_HOST")}/assets/mailer/republique")
|
||||
expect(subject.message.to_s).to include("demarches.gouv.fr/users/confirmation")
|
||||
expect(subject.message.to_s).to include("//demarches.gouv.fr/assets/mailer/republique")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ RSpec.describe DeviseUserMailer, type: :mailer do
|
|||
|
||||
it "respect preferred domain" do
|
||||
expect(header_value("From", subject.message)).to include("@demarches.gouv.fr")
|
||||
expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST")}/users/password")
|
||||
expect(subject.message.to_s).to include("demarches.gouv.fr/users/password")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it 'includes the correct body content and sender email' do
|
||||
expect(subject.body).to include(dossier_url(dossier, host: ENV.fetch('APP_HOST')))
|
||||
expect(subject.body).to include(dossier_url(dossier, host: 'demarches.gouv.fr'))
|
||||
expect(header_value("From", subject)).to include("ne-pas-repondre@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
|
@ -333,7 +333,7 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
context 'when recipient has preferred domain' do
|
||||
let(:dossier_transfer) { create(:dossier_transfer, email: create(:user, preferred_domain: :demarches_gouv_fr).email) }
|
||||
it 'includes a link with the preferred domain in the email body' do
|
||||
expect(subject.body).to include(dossiers_url(statut: "dossiers-transferes", host: ENV.fetch("APP_HOST")))
|
||||
expect(subject.body).to include(dossiers_url(statut: "dossiers-transferes", host: 'demarches.gouv.fr'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it 'adjusts links and sender email for user preferred domain' do
|
||||
expect(mail.body).to have_link(href: dossier_url(dossier, host: ENV.fetch("APP_HOST")))
|
||||
expect(mail.body).to have_link(href: dossier_url(dossier, host: 'demarches.gouv.fr'))
|
||||
expect(header_value("From", mail)).to include("@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe UserMailer, type: :mailer do
|
|||
let(:user) { create(:user, preferred_domain: :demarches_gouv_fr) }
|
||||
|
||||
it do
|
||||
expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path, host: ENV.fetch("APP_HOST")))
|
||||
expect(subject.body).to have_link("Commencer la démarche « #{procedure.libelle} »", href: commencer_sign_in_url(path: procedure.path, host: "demarches.gouv.fr"))
|
||||
expect(header_value("From", subject)).to include("@demarches.gouv.fr")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue