From 421f125c4512db7023b664c4797f4bbf5f12db10 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 3 Dec 2018 12:51:45 +0000 Subject: [PATCH] gestionnaire_spec: factorize a assign helper --- spec/models/gestionnaire_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/models/gestionnaire_spec.rb b/spec/models/gestionnaire_spec.rb index 00fdfac58..e725099d6 100644 --- a/spec/models/gestionnaire_spec.rb +++ b/spec/models/gestionnaire_spec.rb @@ -6,10 +6,10 @@ describe Gestionnaire, type: :model do let!(:procedure_2) { create :procedure, :published, administrateur: admin } let!(:procedure_3) { create :procedure, :published, administrateur: admin } let(:gestionnaire) { create :gestionnaire, administrateurs: [admin] } - let!(:procedure_assign) { create :assign_to, gestionnaire: gestionnaire, procedure: procedure } + let!(:procedure_assign) { assign(procedure) } before do - create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2 + assign(procedure_2) end describe 'follow' do @@ -390,4 +390,10 @@ describe Gestionnaire, type: :model do it { expect(follow.demande_seen_at).to eq(freeze_date) } end end + + private + + def assign(procedure_to_assign) + create :assign_to, gestionnaire: gestionnaire, procedure: procedure_to_assign + end end