don't copy api_entreprise_token when cloning

except for an admin who owns the parent procedure
This commit is contained in:
Christophe Robillard 2020-04-29 16:55:52 +02:00
parent 8130e1d2b5
commit ddd3e6bb02
2 changed files with 5 additions and 0 deletions

View file

@ -306,6 +306,7 @@ class Procedure < ApplicationRecord
if is_different_admin
procedure.administrateurs = [admin]
procedure.api_entreprise_token = nil
else
procedure.administrateurs = administrateurs
end

View file

@ -461,6 +461,10 @@ describe Procedure do
end
end
it 'should discard specific api_entreprise_token' do
expect(subject.read_attribute(:api_entreprise_token)).to be_nil
end
it 'should have one administrateur' do
expect(subject.administrateurs).to eq([administrateur])
end