2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-06 15:51:08 +01:00
|
|
|
describe 'instructeur_mailer/send_notifications', type: :view do
|
2019-08-06 11:02:54 +02:00
|
|
|
let(:instructeur) { create(:instructeur) }
|
2019-03-13 17:59:33 +01:00
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:data, data)
|
|
|
|
|
2024-03-26 17:23:42 +01:00
|
|
|
allow(Current).to receive(:application_name).and_return(APPLICATION_NAME)
|
|
|
|
|
2019-03-13 17:59:33 +01:00
|
|
|
render
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is one dossier in contruction' do
|
|
|
|
let(:data) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
procedure_libelle: 'une superbe démarche',
|
|
|
|
procedure_id: 213,
|
|
|
|
nb_en_construction: 1,
|
2020-03-13 10:24:25 +01:00
|
|
|
nb_en_instruction: 0,
|
|
|
|
nb_accepted: 0,
|
2019-03-13 17:59:33 +01:00
|
|
|
nb_notification: 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2020-07-07 12:03:32 +02:00
|
|
|
it { expect(rendered).to have_link('une superbe démarche', href: instructeur_procedure_url(213)) }
|
2019-03-13 17:59:33 +01:00
|
|
|
it { expect(rendered).to have_text('une superbe démarche') }
|
|
|
|
it { expect(rendered).to have_text('1 dossier en construction') }
|
|
|
|
it { expect(rendered).not_to have_text('notification') }
|
|
|
|
end
|
|
|
|
|
2020-03-13 10:24:25 +01:00
|
|
|
context 'when there is one declarated dossier in instruction' do
|
|
|
|
let(:data) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
procedure_libelle: 'une superbe démarche',
|
|
|
|
procedure_id: 213,
|
|
|
|
nb_en_construction: 0,
|
|
|
|
nb_en_instruction: 1,
|
|
|
|
nb_accepted: 0,
|
|
|
|
nb_notification: 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2020-07-07 12:03:32 +02:00
|
|
|
it { expect(rendered).to have_link('une superbe démarche', href: instructeur_procedure_url(213)) }
|
2020-03-13 10:24:25 +01:00
|
|
|
it { expect(rendered).to have_text('une superbe démarche') }
|
|
|
|
it { expect(rendered).to have_text('1 dossier') }
|
|
|
|
it { expect(rendered).not_to have_text('notification') }
|
|
|
|
it { expect(rendered).not_to have_text('construction') }
|
|
|
|
it { expect(rendered).not_to have_text('accepte') }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is one declarated dossier in accepte' do
|
|
|
|
let(:data) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
procedure_libelle: 'une superbe démarche',
|
|
|
|
procedure_id: 213,
|
|
|
|
nb_en_construction: 0,
|
|
|
|
nb_en_instruction: 0,
|
|
|
|
nb_accepted: 1,
|
|
|
|
nb_notification: 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2020-07-07 12:03:32 +02:00
|
|
|
it { expect(rendered).to have_link('une superbe démarche', href: instructeur_procedure_url(213)) }
|
2020-03-13 10:24:25 +01:00
|
|
|
it { expect(rendered).to have_text('une superbe démarche') }
|
|
|
|
it { expect(rendered).to have_text('1 dossier') }
|
|
|
|
it { expect(rendered).not_to have_text('notification') }
|
|
|
|
it { expect(rendered).not_to have_text('construction') }
|
|
|
|
it { expect(rendered).not_to have_text('instruction') }
|
|
|
|
end
|
|
|
|
|
2019-03-13 17:59:33 +01:00
|
|
|
context 'when there is one notification' do
|
|
|
|
let(:data) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
procedure_libelle: 'une superbe démarche',
|
|
|
|
procedure_id: 213,
|
|
|
|
nb_en_construction: 0,
|
2020-03-13 10:24:25 +01:00
|
|
|
nb_en_instruction: 0,
|
|
|
|
nb_accepted: 0,
|
2019-03-13 17:59:33 +01:00
|
|
|
nb_notification: 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(rendered).not_to have_text('en construction') }
|
|
|
|
it { expect(rendered).to have_text('1 notification') }
|
|
|
|
end
|
|
|
|
end
|