amelioration(procedure.chorus): connecte la tuile a un controller basique ayant les ACL

This commit is contained in:
Martin 2023-08-28 14:56:52 +02:00
parent 7d7a741a1a
commit fea0cb1c60
4 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,8 @@
module Administrateurs
class ChorusController < AdministrateurController
before_action :retrieve_procedure
def edit
end
end
end

View file

@ -0,0 +1,9 @@
= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Démarches', admin_procedures_path],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
['Connecteur Chorus']] }
.container
%h1.mb-2
Cadre budgétaire

View file

@ -601,6 +601,7 @@ Rails.application.routes.draw do
resource :attestation_template, only: [:show, :edit, :update, :create] do resource :attestation_template, only: [:show, :edit, :update, :create] do
get 'preview', on: :member get 'preview', on: :member
end end
resource :chorus, only: [:edit]
resource :dossier_submitted_message, only: [:edit, :update, :create] resource :dossier_submitted_message, only: [:edit, :update, :create]
# ADDED TO ACCESS IT FROM THE IFRAME # ADDED TO ACCESS IT FROM THE IFRAME
get 'attestation_template/preview' => 'attestation_templates#preview' get 'attestation_template/preview' => 'attestation_templates#preview'

View file

@ -0,0 +1,22 @@
describe Administrateurs::ChorusController, type: :controller do
describe 'edit' do
let(:user) { create(:user) }
let(:admin) { create(:administrateur, user: create(:user)) }
let(:procedure) { create(:procedure, administrateurs: [admin]) }
subject { get :edit, params: { procedure_id: procedure.id } }
context 'not signed in' do
it { is_expected.to redirect_to(new_user_session_path) }
end
context 'signed in but not admin of procedure' do
before { sign_in(user) }
it { is_expected.to redirect_to(new_user_session_path) }
end
context 'signed as admin' do
before { sign_in(admin.user) }
it { is_expected.to have_http_status(200) }
end
end
end