fix(avis_controller): revoked acl on update

This commit is contained in:
simon lehericey 2022-11-29 10:57:00 +01:00 committed by LeSim
parent 3be17da70e
commit 531cbf2612
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, :update]
before_action :check_if_avis_revoked, only: [:show, :instruction, :create_avis, :update, :sign_up]
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

@ -447,6 +447,12 @@ describe Experts::AvisController, type: :controller do
get :sign_up, params: { id: avis.id, procedure_id: procedure.id, email: avis.expert.email }
end
context 'when the avis is revoked' do
before { avis.update(revoked_at: Time.zone.now) }
it { is_expected.to redirect_to(root_path) }
end
context 'when the expert hasnt signed up yet' do
before { expert.user.update(last_sign_in_at: nil) }