Add default etablissement champ name

This commit is contained in:
Paul Chavard 2019-07-30 15:39:42 +02:00
parent ab1170bcfc
commit 8c72470a6c
2 changed files with 6 additions and 1 deletions

View file

@ -120,6 +120,6 @@ class Etablissement < ApplicationRecord
end
def libelle_for_export
champ&.libelle
champ&.libelle || 'Dossier'
end
end

View file

@ -93,6 +93,9 @@ describe ProcedureExportV2Service do
context 'with etablissement' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
let(:dossier_etablissement) { etablissements_sheet.data[1] }
let(:champ_etablissement) { etablissements_sheet.data[0] }
it 'should have headers' do
expect(etablissements_sheet.headers).to eq([
"Dossier ID",
@ -132,6 +135,8 @@ describe ProcedureExportV2Service do
it 'should have data' do
expect(etablissements_sheet.data.size).to eq(2)
expect(dossier_etablissement[1]).to eq("Dossier")
expect(champ_etablissement[1]).to eq("siret")
end
end