From 842cc11689959253cadca6e426b0004f7a1f3032 Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Fri, 28 Jan 2022 15:08:08 +0100 Subject: [PATCH] tests --- .../instructeurs/dossiers_controller_spec.rb | 21 +++++++++++++++++++ .../procedures/_list.html.haml_spec.rb | 1 + 2 files changed, 22 insertions(+) diff --git a/spec/controllers/instructeurs/dossiers_controller_spec.rb b/spec/controllers/instructeurs/dossiers_controller_spec.rb index 336afd076..8cde2714c 100644 --- a/spec/controllers/instructeurs/dossiers_controller_spec.rb +++ b/spec/controllers/instructeurs/dossiers_controller_spec.rb @@ -839,4 +839,25 @@ describe Instructeurs::DossiersController, type: :controller do end end end + + describe '#restore' do + let(:instructeur) { create(:instructeur) } + let!(:gi_p1_1) { GroupeInstructeur.create(label: '1', procedure: procedure) } + let!(:procedure) { create(:procedure, :published, instructeurs: [instructeur]) } + let!(:dossier) { create(:dossier, state: 'accepte', procedure: procedure, groupe_instructeur: procedure.groupe_instructeurs.first, hidden_by_administration_at: 1.hour.ago) } + + before do + sign_in(instructeur.user) + instructeur.groupe_instructeurs << gi_p1_1 + patch :restore, + params: { + procedure_id: procedure.id, + dossier_id: dossier.id + } + end + + it "puts hidden_by_administration_at to nil" do + expect(dossier.reload.hidden_by_administration_at).to eq(nil) + end + end end diff --git a/spec/views/instructeur/procedures/_list.html.haml_spec.rb b/spec/views/instructeur/procedures/_list.html.haml_spec.rb index 7de854f9a..9c9de8f25 100644 --- a/spec/views/instructeur/procedures/_list.html.haml_spec.rb +++ b/spec/views/instructeur/procedures/_list.html.haml_spec.rb @@ -8,6 +8,7 @@ describe 'instructeurs/procedures/_list.html.haml', type: :view do dossiers_a_suivre_count_per_procedure: 2, dossiers_archived_count_per_procedure: 1, dossiers_termines_count_per_procedure: 1, + dossiers_supprimes_recemment_count_per_procedure: 0, dossiers_expirant_count_per_procedure: 0, followed_dossiers_count_per_procedure: 0, procedure_ids_en_cours_with_notifications: [],