Add groupe_instructeur_label to export v1

This commit is contained in:
simon lehericey 2019-09-18 17:52:02 +02:00
parent 3bc20bdb06
commit f577484aa2
2 changed files with 33 additions and 5 deletions

View file

@ -19,8 +19,8 @@ describe ProcedureExportService do
end
context 'dossiers' do
it 'should have headers' do
expect(headers).to eq([
let(:nominal_header) do
[
:id,
:created_at,
:updated_at,
@ -86,7 +86,19 @@ describe ProcedureExportService do
:entreprise_date_creation,
:entreprise_nom,
:entreprise_prenom
])
]
end
it 'should have headers' do
expect(headers).to eq(nominal_header)
end
context 'with a procedure routee' do
before { procedure.groupe_instructeurs.create(label: '2') }
let(:routee_header) { nominal_header.insert(nominal_header.index(:textarea), :groupe_instructeur_label) }
it { expect(headers).to eq(routee_header) }
end
it 'should have empty values' do
@ -139,6 +151,13 @@ describe ProcedureExportService do
])
end
context 'with a procedure routee' do
before { procedure.groupe_instructeurs.create(label: '2') }
it { expect(data.first[15]).to eq('défaut') }
it { expect(data.first.count).to eq(dossier_data.count + champs_data.count + etablissement_data.count + 1) }
end
context 'and etablissement' do
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }