correctif(spec): associe le dossier suivis a l'instructeur du batch operation. sinon c'est un autre instructeur qui est crée

This commit is contained in:
Martin 2023-01-16 10:16:23 +01:00 committed by Lisa Durand
parent 8fbb866aba
commit 0aba708b34
2 changed files with 5 additions and 5 deletions

View file

@ -56,8 +56,8 @@ FactoryBot.define do
after(:build) do |batch_operation, evaluator| after(:build) do |batch_operation, evaluator|
procedure = create(:simple_procedure, :published, instructeurs: [evaluator.invalid_instructeur.presence || batch_operation.instructeur], administrateurs: [create(:administrateur)]) procedure = create(:simple_procedure, :published, instructeurs: [evaluator.invalid_instructeur.presence || batch_operation.instructeur], administrateurs: [create(:administrateur)])
batch_operation.dossiers = [ batch_operation.dossiers = [
create(:dossier, :with_individual, :followed, :en_instruction, procedure: procedure), create(:dossier, :with_individual, :en_instruction, procedure: procedure, followers_instructeurs: procedure.instructeurs),
create(:dossier, :with_individual, :followed, :en_construction, procedure: procedure) create(:dossier, :with_individual, :en_construction, procedure: procedure, followers_instructeurs: procedure.instructeurs)
] ]
end end
end end

View file

@ -68,9 +68,9 @@ describe BatchOperationProcessOneJob, type: :job do
it 'removes a follower to the dossier' do it 'removes a follower to the dossier' do
expect { subject.perform_now } expect { subject.perform_now }
.to change { dossier_job.reload.follows.first.unfollowed_at } .to change { dossier_job.reload.follows.count }
.from(nil) .from(1)
.to(anything) .to(0)
end end
end end