2021-12-03 16:21:41 +01:00
|
|
|
describe 'instructeurs/procedures/_tabs.html.haml', 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
|
2021-12-03 16:21:41 +01:00
|
|
|
render('instructeurs/procedures/tabs.html.haml',
|
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,
|
|
|
|
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
|