specs: improve ProcedureExportService spec
This commit is contained in:
parent
99ece20cb2
commit
00adb006b4
1 changed files with 8 additions and 8 deletions
|
@ -25,13 +25,13 @@ describe ProcedureExportService do
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'dossiers' do
|
describe 'sheets' do
|
||||||
it 'should have sheets' do
|
it 'should have a sheet for each record type' do
|
||||||
expect(subject.sheets.map(&:name)).to eq(['Dossiers', 'Etablissements', 'Avis'])
|
expect(subject.sheets.map(&:name)).to eq(['Dossiers', 'Etablissements', 'Avis'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with dossier' do
|
describe 'Dossiers sheet' do
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
|
||||||
|
|
||||||
let(:nominal_headers) do
|
let(:nominal_headers) do
|
||||||
|
@ -97,14 +97,14 @@ describe ProcedureExportService do
|
||||||
context 'with a procedure routee' do
|
context 'with a procedure routee' do
|
||||||
before { procedure.groupe_instructeurs.create(label: '2') }
|
before { procedure.groupe_instructeurs.create(label: '2') }
|
||||||
|
|
||||||
let(:routee_header) { nominal_headers.insert(nominal_headers.index('textarea'), 'Groupe instructeur') }
|
let(:routee_headers) { nominal_headers.insert(nominal_headers.index('textarea'), 'Groupe instructeur') }
|
||||||
|
|
||||||
it { expect(dossiers_sheet.headers).to match(routee_header) }
|
it { expect(dossiers_sheet.headers).to match(routee_headers) }
|
||||||
it { expect(dossiers_sheet.data[0][dossiers_sheet.headers.index('Groupe instructeur')]).to eq('défaut') }
|
it { expect(dossiers_sheet.data[0][dossiers_sheet.headers.index('Groupe instructeur')]).to eq('défaut') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with etablissement' do
|
describe 'Etablissement sheet' do
|
||||||
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ describe ProcedureExportService do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with avis' do
|
describe 'Avis sheet' do
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) }
|
||||||
let!(:avis) { create(:avis, :with_answer, dossier: dossier) }
|
let!(:avis) { create(:avis, :with_answer, dossier: dossier) }
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ describe ProcedureExportService do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with repetitions' do
|
describe 'Repetitions sheet' do
|
||||||
let!(:dossiers) do
|
let!(:dossiers) do
|
||||||
[
|
[
|
||||||
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure),
|
create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure),
|
||||||
|
|
Loading…
Add table
Reference in a new issue