2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-06 15:51:08 +01:00
|
|
|
describe 'instructeurs/procedures/_tabs', type: :view do
|
2021-12-02 16:19:17 +01:00
|
|
|
let(:procedure) { create(:procedure, id: 1, procedure_expires_when_termine_enabled: expiration_enabled) }
|
|
|
|
|
|
|
|
before { allow(view).to receive(:current_instructeur).and_return(create(:instructeur)) }
|
2021-12-02 15:56:34 +01:00
|
|
|
|
|
|
|
subject do
|
2023-03-06 15:51:08 +01:00
|
|
|
render('instructeurs/procedures/tabs',
|
2021-12-02 15:56:34 +01:00
|
|
|
procedure: procedure,
|
|
|
|
statut: 'tous',
|
|
|
|
a_suivre_count: 0,
|
|
|
|
suivis_count: 0,
|
|
|
|
traites_count: 0,
|
|
|
|
tous_count: 0,
|
2024-07-18 14:15:29 +02:00
|
|
|
supprimes_count: 0,
|
2021-12-02 15:56:34 +01:00
|
|
|
archives_count: 0,
|
|
|
|
expirant_count: 0,
|
|
|
|
has_en_cours_notifications: false,
|
2021-12-02 16:19:17 +01:00
|
|
|
has_termine_notifications: false)
|
2021-12-02 15:56:34 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when procedure_expires_when_termine_enabled is true' do
|
|
|
|
let(:expiration_enabled) { true }
|
|
|
|
it 'contains link to expiring dossiers within procedure' do
|
|
|
|
expect(subject).to have_selector(%Q(a[href="#{instructeur_procedure_path(procedure, statut: 'expirant')}"]), count: 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when procedure_expires_when_termine_enabled is false' do
|
|
|
|
let(:expiration_enabled) { false }
|
|
|
|
it 'does not contain link to expiring dossiers within procedure' do
|
|
|
|
expect(subject).to have_selector(%Q(a[href="#{instructeur_procedure_path(procedure, statut: 'expirant')}"]), count: 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|