gestionnaire_spec: factorize a assign helper

This commit is contained in:
Pierre de La Morinerie 2018-12-03 12:51:45 +00:00
parent 2e29825415
commit 421f125c45

View file

@ -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