A cloned procedure should not have canonical relationship

This commit is contained in:
Paul Chavard 2020-02-25 13:47:44 +01:00
parent a025fa124e
commit 24d237de9e
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