feat(move_type_de_champ): stop renumbering all procedure_revision_type_de_champ on move_type_de_champ

This commit is contained in:
Martin 2024-01-17 15:51:06 +01:00 committed by mfo
parent 4b57ed871a
commit 4d97c5bc8a
2 changed files with 18 additions and 8 deletions

View file

@ -103,20 +103,19 @@ describe ProcedureRevision do
context 'with 4 types de champ publiques' do
it 'move down' do
expect(draft.types_de_champ_public.index(type_de_champ_public)).to eq(0)
stable_id_before = draft.revision_types_de_champ_public.map(&:stable_id)
draft.move_type_de_champ(type_de_champ_public.stable_id, 2)
draft.reload
expect(draft.revision_types_de_champ_public.map(&:position)).to eq([0,1,2,3])
expect(draft.types_de_champ_public.index(type_de_champ_public)).to eq(2)
expect(draft.procedure.types_de_champ_for_procedure_presentation.not_repetition.index(type_de_champ_public)).to eq(2)
end
it 'move up' do
expect(draft.types_de_champ_public.index(last_type_de_champ)).to eq(3)
draft.move_type_de_champ(last_type_de_champ.stable_id, 0)
draft.reload
expect(draft.revision_types_de_champ_public.map(&:position)).to eq([0,1,2,3])
expect(draft.types_de_champ_public.index(last_type_de_champ)).to eq(0)
expect(draft.procedure.types_de_champ_for_procedure_presentation.not_repetition.index(last_type_de_champ)).to eq(0)
end