helpers: allow champ without persisted dossier

This fixes the /patron page. I also added an end-to-end test
to avoid breaking this page in the future.
This commit is contained in:
Pierre de La Morinerie 2022-05-31 08:44:40 +02:00
parent 854274cae3
commit 2b90d7cc01
2 changed files with 9 additions and 1 deletions

View file

@ -28,7 +28,7 @@ module ChampHelper
def autosave_available?(champ)
# FIXME: enable autosave on champs private? once we figured out how to batch audit events
champ.dossier.brouillon? && !champ.repetition?
champ.dossier&.brouillon? && !champ.repetition?
end
def geo_area_label(geo_area)

View file

@ -0,0 +1,8 @@
describe 'Accessing the /patron page:' do
scenario 'I can display a page with all form fields and UI elements' do
visit patron_path
expect(page).to have_text('Icônes')
expect(page).to have_text('Formulaires')
expect(page).to have_text('Boutons')
end
end