fix(avis_controller): revoked acl on update

This commit is contained in:
simon lehericey 2022-11-29 10:34:04 +01:00 committed by LeSim
parent cb2e1db52e
commit 3be17da70e
2 changed files with 7 additions and 1 deletions

View file

@ -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]
before_action :check_if_avis_revoked, only: [:show, :instruction, :create_avis, :update]
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]

View file

@ -190,6 +190,12 @@ describe Experts::AvisController, type: :controller do
avis.reload
end
context 'on a revoked avis' do
let(:avis) { revoked_avis }
it { expect(subject).to redirect_to(root_path) }
end
context 'without attachment' do
it 'should be ok' do
expect(subject).to redirect_to(instruction_expert_avis_path(avis.procedure, avis))