bug(merge_fork): un dossier etant sur une revision passee avec une repetition qui a ete supprime ne peut merge_fork
This commit is contained in:
parent
30f6aaed34
commit
5c9101d15f
2 changed files with 18 additions and 4 deletions
|
@ -172,9 +172,6 @@ module DossierCloneConcern
|
||||||
champs_to_remove += diff[:removed]
|
champs_to_remove += diff[:removed]
|
||||||
champs_to_remove
|
champs_to_remove
|
||||||
.filter { !_1.child? || !champs_to_remove.include?(_1.parent) }
|
.filter { !_1.child? || !champs_to_remove.include?(_1.parent) }
|
||||||
.each do |champ|
|
.each(&:destroy!)
|
||||||
champ.rows.flatten.each(&:destroy!) if champ.repetition?
|
|
||||||
champ.destroy!
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -341,5 +341,22 @@ RSpec.describe DossierCloneConcern do
|
||||||
expect(Dossier.exists?(forked_dossier.id)).to be_falsey
|
expect(Dossier.exists?(forked_dossier.id)).to be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with old revision having repetition' do
|
||||||
|
let(:added_champ) { nil }
|
||||||
|
let(:removed_champ) { dossier.champs.find(&:repetition?) }
|
||||||
|
let(:updated_champ) { nil }
|
||||||
|
|
||||||
|
before do
|
||||||
|
dossier.champs.each do |champ|
|
||||||
|
champ.update(value: 'old value')
|
||||||
|
end
|
||||||
|
procedure.draft_revision.remove_type_de_champ(removed_champ.stable_id)
|
||||||
|
procedure.publish_revision!
|
||||||
|
end
|
||||||
|
it 'works' do
|
||||||
|
expect { subject }.not_to raise_error(ActiveRecord::InvalidForeignKey)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue