feat(groupe_instructeurs): import instructeurs in unrouted procedure with a proper CSV
This commit is contained in:
parent
3aa7793ed3
commit
25df48f255
10 changed files with 184 additions and 38 deletions
|
@ -1,5 +1,5 @@
|
|||
describe InstructeursImportService do
|
||||
describe '#import' do
|
||||
describe '#import_groupes' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
let(:procedure_groupes) do
|
||||
|
@ -9,7 +9,7 @@ describe InstructeursImportService do
|
|||
.to_h
|
||||
end
|
||||
|
||||
subject { described_class.import(procedure, lines) }
|
||||
subject { described_class.import_groupes(procedure, lines) }
|
||||
|
||||
context 'nominal case' do
|
||||
let(:lines) do
|
||||
|
@ -20,7 +20,7 @@ describe InstructeursImportService do
|
|||
]
|
||||
end
|
||||
|
||||
it 'imports' do
|
||||
it 'imports groupes' do
|
||||
errors = subject
|
||||
|
||||
expect(procedure_groupes.keys).to contain_exactly("Auvergne Rhone-Alpes", "Occitanie", "défaut")
|
||||
|
@ -126,4 +126,21 @@ describe InstructeursImportService do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#import_instructeurs' do
|
||||
let(:procedure_non_routee) { create(:procedure) }
|
||||
|
||||
subject { described_class.import_instructeurs(procedure_non_routee, emails) }
|
||||
|
||||
context 'nominal case' do
|
||||
let(:emails) { [{ "email" => "john@lennon.fr" }, { "email" => "paul@mccartney.uk" }, { "email" => "ringo@starr.uk" }] }
|
||||
|
||||
it 'imports instructeurs' do
|
||||
errors = subject
|
||||
expect(procedure_non_routee.defaut_groupe_instructeur.instructeurs.pluck(:email)).to contain_exactly("john@lennon.fr", "paul@mccartney.uk", "ringo@starr.uk")
|
||||
|
||||
expect(errors).to match_array([])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue