Skip to content

Commit

Permalink
Merge pull request #10008 from colinux/fix-draft-procedure-descriptio…
Browse files Browse the repository at this point in the history
…n-cache

ETQ admin: correction du cache de la liste des PJ d'une démarche en brouillon
  • Loading branch information
colinux authored Feb 16, 2024
2 parents 4f58795 + a783c50 commit fc482c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/shared/_procedure_description.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
14 changes: 14 additions & 0 deletions spec/views/shared/_procedure_description.html.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,19 @@
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

0 comments on commit fc482c1

Please sign in to comment.