diff --git a/app/controllers/new_administrateur/experts_procedures_controller.rb b/app/controllers/new_administrateur/experts_procedures_controller.rb index 1b965f0dc..0a246ed12 100644 --- a/app/controllers/new_administrateur/experts_procedures_controller.rb +++ b/app/controllers/new_administrateur/experts_procedures_controller.rb @@ -33,7 +33,7 @@ module NewAdministrateur end def revoke_expert_from_procedure - expert_procedure = ExpertsProcedure.find_by!(procedure: @procedure, id: params[:expert_procedure][:id]) + expert_procedure = ExpertsProcedure.find_by!(procedure: @procedure, id: params[:id]) expert_email = expert_procedure.expert.email expert_procedure.update!(revoked_at: Time.zone.now) flash[:notice] = "#{expert_email} a été révoqué de la démarche et ne pourra plus déposer d'avis." diff --git a/config/routes.rb b/config/routes.rb index 81156cf26..9ae110e28 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -408,8 +408,6 @@ Rails.application.routes.draw do post 'transfer' => 'procedures#transfer', as: :transfer get 'invited_expert_list' put 'update_allow_decision_access' => 'procedures#update_allow_decision_access', as: :update_allow_decision_access - post 'add_expert_to_procedure' => 'experts_procedures#add_expert_to_procedure', as: :add_expert_to_procedure - put 'revoke_expert_from_procedure' => 'experts_procedures#revoke_expert_from_procedure', as: :revoke_expert_from_procedure resources :mail_templates, only: [:edit, :update] resources :groupe_instructeurs, only: [:index, :show, :create, :update, :destroy] do @@ -427,6 +425,11 @@ Rails.application.routes.draw do resources :administrateurs, controller: 'procedure_administrateurs', only: [:index, :create, :destroy] + resources :experts, controller: 'experts_procedures', only: [] do + post :add_expert_to_procedure, on: :collection + delete :revoke_expert_from_procedure, on: :member + end + resources :types_de_champ, only: [:create, :update, :destroy] do member do patch :move diff --git a/spec/controllers/new_administrateur/experts_procedures_controller_spec.rb b/spec/controllers/new_administrateur/experts_procedures_controller_spec.rb index 39e28e3f9..41a0b637e 100644 --- a/spec/controllers/new_administrateur/experts_procedures_controller_spec.rb +++ b/spec/controllers/new_administrateur/experts_procedures_controller_spec.rb @@ -32,7 +32,7 @@ describe NewAdministrateur::ExpertsProceduresController, type: :controller do let(:expert_procedure) { ExpertsProcedure.create(expert: expert, procedure: procedure) } subject do - put :revoke_expert_from_procedure, params: { procedure_id: procedure.id, expert_procedure: { id: expert_procedure.id } } + delete :revoke_expert_from_procedure, params: { procedure_id: procedure.id, id: expert_procedure.id } end before do