Add new testss

This commit is contained in:
Kara Diaby 2023-11-27 14:52:55 +00:00
parent d0e2f281cc
commit 303230dd1d
6 changed files with 113 additions and 2 deletions

View file

@ -35,6 +35,24 @@ describe 'users/dossiers/brouillon', type: :view do
let(:procedure) { create(:procedure) }
it { is_expected.not_to have_link("Télécharger le guide de la démarche") }
end
context 'when a dossier is for_tiers and the dossier is in brouillon with email notification' do
let(:dossier) { create(:dossier, :for_tiers_with_notification) }
it 'displays the informations of the mandataire and the beneficiaire email' do
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
expect(rendered).to have_text("Email :\n\n\n#{dossier.individual.email}")
end
end
context 'when a dossier is for_tiers and the dossier is in brouillon with no notification' do
let!(:dossier) { create(:dossier, :for_tiers_without_notification) }
it 'displays the informations of the mandataire and do not display the beneficiary email' do
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
expect(rendered).not_to have_text("Email :\n\n\n#{dossier.individual.email}")
end
end
end
context "as an administrateur" do

View file

@ -48,4 +48,14 @@ describe 'users/dossiers/demande', type: :view do
expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
end
end
context 'when a dossier is for_tiers and the dossier is en_construction with email notification' do
let(:dossier) { create(:dossier, :en_construction, :for_tiers_with_notification) }
it 'displays the informations of the mandataire' do
expect(rendered).to have_text('Email du mandataire')
expect(rendered).to have_text("#{dossier.mandataire_full_name} agit pour le compte du bénéficiaire :")
expect(rendered).to have_text(dossier.individual.email.to_s)
end
end
end