migrate emails text editor to new interface
This commit is contained in:
parent
a51d6046dc
commit
ae61c279af
17 changed files with 154 additions and 166 deletions
|
@ -1,31 +0,0 @@
|
|||
describe Admin::MailTemplatesController, type: :controller do
|
||||
let(:procedure) { create :procedure }
|
||||
let(:initiated_mail) { Mails::InitiatedMail.default_for_procedure(procedure) }
|
||||
|
||||
before do
|
||||
sign_in(procedure.administrateurs.first.user)
|
||||
end
|
||||
|
||||
describe 'PATCH update' do
|
||||
let(:mail_subject) { 'plop modif' }
|
||||
let(:mail_body) { 'plip modif' }
|
||||
|
||||
before :each do
|
||||
patch :update,
|
||||
params: {
|
||||
procedure_id: procedure.id,
|
||||
id: initiated_mail.class.const_get(:SLUG),
|
||||
mail_template: { subject: mail_subject, body: mail_body }
|
||||
}
|
||||
end
|
||||
|
||||
it { expect(response).to redirect_to edit_admin_procedure_mail_template_path(procedure, initiated_mail.class.const_get(:SLUG)) }
|
||||
|
||||
context 'the mail template' do
|
||||
subject { procedure.reload; procedure.initiated_mail_template }
|
||||
|
||||
it { expect(subject.subject).to eq(mail_subject) }
|
||||
it { expect(subject.body).to eq(mail_body) }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -42,4 +42,27 @@ describe NewAdministrateur::MailTemplatesController, type: :controller do
|
|||
expect(response.body).to include(procedure.service.telephone)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PATCH update' do
|
||||
let(:mail_subject) { 'Mise à jour de votre démarche' }
|
||||
let(:mail_body) { '<div>Une mise à jour a été effectuée sur votre démarche n° --demarche-id--.</div>' }
|
||||
|
||||
before :each do
|
||||
patch :update,
|
||||
params: {
|
||||
procedure_id: procedure.id,
|
||||
id: initiated_mail.class.const_get(:SLUG),
|
||||
mails_initiated_mail: { subject: mail_subject, rich_body: mail_body }
|
||||
}
|
||||
end
|
||||
|
||||
it { expect(response).to redirect_to edit_admin_procedure_mail_template_path(procedure, initiated_mail.class.const_get(:SLUG)) }
|
||||
|
||||
context 'the mail template' do
|
||||
subject { procedure.reload; procedure.initiated_mail_template }
|
||||
|
||||
it { expect(subject.subject).to eq(mail_subject) }
|
||||
it { expect(subject.body).to eq(mail_body) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,7 +42,7 @@ describe Procedure do
|
|||
describe 'closed mail template body' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
subject { procedure.closed_mail_template.body }
|
||||
subject { procedure.closed_mail_template.rich_body.body.to_html }
|
||||
|
||||
context 'for procedures without an attestation' do
|
||||
it { is_expected.not_to include('lien attestation') }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
describe 'admin/mail_templates/edit.html.haml', type: :view do
|
||||
describe 'new_administrateur/mail_templates/edit.html.haml', type: :view do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let(:mail_template) { create(:received_mail, procedure: procedure) }
|
||||
let(:all_tags) { mail_template.tags }
|
||||
|
||||
before do
|
||||
allow(view).to receive(:admin_procedure_mail_template_path).and_return("/toto")
|
||||
allow(view).to receive(:admin_procedure_mail_templates_path).and_return("/toto")
|
||||
allow(view).to receive(:admin_procedure_mail_templates_path).and_return("/toto")
|
||||
|
||||
assign(:mail_template, mail_template)
|
||||
|
@ -13,6 +13,5 @@ describe 'admin/mail_templates/edit.html.haml', type: :view do
|
|||
|
||||
context "Champs are listed in the page" do
|
||||
it { expect(all_tags).to include(include({ libelle: 'numéro du dossier' })) }
|
||||
it { expect(render).to include("numéro du dossier") }
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue