fix(export): remove wrong columns from repetition spreadsheets

This fix prevent repetition children types de champ from being pulled from cloned procedures. stable_id is stable across revisions but also across cloned procedures.
This commit is contained in:
Paul Chavard 2021-11-10 20:45:32 +01:00
parent f5fc5022a6
commit 71939c650b
2 changed files with 19 additions and 11 deletions

View file

@ -342,13 +342,22 @@ describe ProcedureExportService do
expect(subject.sheets.map(&:name)).to eq(['Dossiers', 'Etablissements', 'Avis', champ_repetition.libelle_for_export])
end
it 'should have headers' do
expect(repetition_sheet.headers).to eq([
"Dossier ID",
"Ligne",
"Nom",
"Age"
])
context 'with cloned procedure' do
let(:other_parent) { create(:type_de_champ_repetition, stable_id: champ_repetition.stable_id) }
before do
create(:procedure_revision_type_de_champ, type_de_champ: other_parent, revision: create(:procedure).active_revision)
create(:type_de_champ, parent: other_parent)
end
it 'should have headers' do
expect(repetition_sheet.headers).to eq([
"Dossier ID",
"Ligne",
"Nom",
"Age"
])
end
end
it 'should have data' do