Merge pull request #4826 from tchak/fix-canonical-clone

Administrateur : cloner une démarche supprime son lien à des révisions précédentes de la démarche
This commit is contained in:
Pierre de La Morinerie 2020-02-25 15:35:36 +01:00 committed by GitHub
commit e4532500f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -295,6 +295,7 @@ class Procedure < ApplicationRecord
procedure.cloned_from_library = from_library
procedure.parent_procedure = self
procedure.canonical_procedure = nil
if from_library
procedure.service = nil

View file

@ -538,6 +538,15 @@ describe Procedure do
expect(subject.deliberation.attached?).to be true
end
end
context 'with canonical procedure' do
let(:canonical_procedure) { create(:procedure) }
let(:procedure) { create(:procedure, canonical_procedure: canonical_procedure, received_mail: received_mail, service: service) }
it 'do not clone canonical procedure' do
expect(subject.canonical_procedure).to be_nil
end
end
end
describe '#publish!' do