From f16addd080c01842b114fd1d0fb6e83c7dfec6c8 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Mon, 23 Sep 2024 15:57:39 +0200 Subject: [PATCH] test(manager): nominal case of #add_administrateur_and_instructor --- .../manager/procedures_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/manager/procedures_controller_spec.rb b/spec/controllers/manager/procedures_controller_spec.rb index d0fc8d476..27dab439a 100644 --- a/spec/controllers/manager/procedures_controller_spec.rb +++ b/spec/controllers/manager/procedures_controller_spec.rb @@ -124,4 +124,18 @@ describe Manager::ProceduresController, type: :controller do end end end + + describe '#add_administrateur_and_instructeur' do + let(:procedure) { create(:procedure, administrateurs: [autre_administrateur]) } + subject { post :add_administrateur_and_instructeur, params: { id: procedure.id } } + + context "when the current super admin is not an administrateur and not an instructeur of the procedure" do + before { administrateur } + it "adds the current super admin as administrateur and instructeur to the procedure" do + subject + expect(procedure.administrateurs).to include(administrateur) + expect(procedure.instructeurs).to include(administrateur.instructeur) + end + end + end end