Merge pull request #10008 from colinux/fix-draft-procedure-description-cache

ETQ admin: correction du cache de la liste des PJ d'une démarche en brouillon
This commit is contained in:
Colin Darie 2024-02-16 07:22:22 +00:00 committed by GitHub
commit fc482c1607
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -24,7 +24,7 @@
- unless @no_description
.fr-accordions-group.fr-mb-3w
- cache [I18n.locale, procedure, "description"] do
- cache_unless(procedure.brouillon?, [I18n.locale, procedure, "description"]) do
%section.fr-accordion
%h2.fr-accordion__title
%button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" }

View file

@ -124,5 +124,19 @@ describe 'shared/_procedure_description', type: :view do
render partial: 'shared/procedure_description', locals: { procedure: }
expect(rendered).to have_text('new pj')
end
context 'draft procedure' do
let(:procedure) { create(:procedure, :draft) }
it 'respect revision changes on brouillon' do
render partial: 'shared/procedure_description', locals: { procedure: }
expect(rendered).not_to have_text('new pj')
procedure.draft_revision.add_type_de_champ(type_champ: :piece_justificative, libelle: 'new pj')
render partial: 'shared/procedure_description', locals: { procedure: }
expect(rendered).to have_text('new pj')
end
end
end
end