From 801d594efd97f5b4305f2361f65e9609306568d4 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Tue, 29 Nov 2022 14:32:03 +0100 Subject: [PATCH] fix(avis_controller): revoked_acl on telecharger_pjs --- app/controllers/experts/avis_controller.rb | 2 +- .../experts/avis_controller_spec.rb | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/controllers/experts/avis_controller.rb b/app/controllers/experts/avis_controller.rb index 034cc99cb..913bef027 100644 --- a/app/controllers/experts/avis_controller.rb +++ b/app/controllers/experts/avis_controller.rb @@ -4,7 +4,7 @@ module Experts include Zipline before_action :authenticate_expert!, except: [:sign_up, :update_expert] - before_action :check_if_avis_revoked, only: [:show, :instruction, :create_avis, :update, :sign_up, :update_expert, :messagerie, :create_commentaire, :bilans_bdf] + before_action :check_if_avis_revoked, only: [:show, :instruction, :create_avis, :update, :sign_up, :update_expert, :messagerie, :create_commentaire, :bilans_bdf, :telecharger_pjs] before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert] before_action :set_avis_and_dossier, only: [:show, :instruction, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs] diff --git a/spec/controllers/experts/avis_controller_spec.rb b/spec/controllers/experts/avis_controller_spec.rb index cb18063d6..4502f3ccb 100644 --- a/spec/controllers/experts/avis_controller_spec.rb +++ b/spec/controllers/experts/avis_controller_spec.rb @@ -91,6 +91,28 @@ describe Experts::AvisController, type: :controller do end end + describe '#telecharger_pjs' do + let(:avis) { avis_with_answer } + + subject { get :telecharger_pjs, params: { id: avis.id, procedure_id: } } + + context 'with a valid avis' do + it { is_expected.to have_http_status(:success) } + end + + context 'with a revoked avis' do + let(:avis) { revoked_avis } + + it { is_expected.to redirect_to(root_path) } + end + + context 'with a another avis' do + let(:avis) { create(:avis) } + + it { is_expected.to redirect_to(expert_all_avis_path) } + end + end + describe '#show' do subject { get :show, params: { id: avis_with_answer.id, procedure_id: } }