tech(champs/repetitions#remove): ajout d'un test pour s'assurer que l'action de suppression d'un bloc repetable fonctionne
This commit is contained in:
parent
1f3215ed46
commit
f59354f787
1 changed files with 13 additions and 0 deletions
13
spec/controllers/champs/repetition_controller_spec.rb
Normal file
13
spec/controllers/champs/repetition_controller_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
describe Champs::RepetitionController, type: :controller do
|
||||||
|
describe '#remove' do
|
||||||
|
let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :repetition, children: [{ libelle: 'Nom' }, { type: :integer_number, libelle: 'Age' }] }]) }
|
||||||
|
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||||
|
|
||||||
|
before { sign_in dossier.user }
|
||||||
|
it 'removes repetition' do
|
||||||
|
rows, repetitions = dossier.champs.partition { _1.parent_id.present? }
|
||||||
|
expect { delete :remove, params: { champ_id: repetitions.first.id, row_id: rows.first.row_id }, format: :turbo_stream }
|
||||||
|
.to change { dossier.reload.champs.size }.from(3).to(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue