From b889d18217d7afea7b4555f4ea46e49b8544b12d Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 5 May 2022 15:19:17 +0200 Subject: [PATCH] spec: use children_of --- spec/models/procedure_revision_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/models/procedure_revision_spec.rb b/spec/models/procedure_revision_spec.rb index b2b5640c0..b0d475cd7 100644 --- a/spec/models/procedure_revision_spec.rb +++ b/spec/models/procedure_revision_spec.rb @@ -126,11 +126,13 @@ describe ProcedureRevision do context 'for a type_de_champ_repetition' do let(:procedure) { create(:procedure, :with_repetition) } + let!(:child) { child = draft.children_of(type_de_champ_repetition).first } it 'can remove its children' do - draft.remove_type_de_champ(type_de_champ_repetition.types_de_champ.first.stable_id) + draft.remove_type_de_champ(child.stable_id) expect(type_de_champ_repetition.types_de_champ).to be_empty + expect { child.reload }.to raise_error ActiveRecord::RecordNotFound expect(draft.types_de_champ_public.size).to eq(1) end end