Add stable ids to types_de_champ after every update

This commit is contained in:
Paul Chavard 2018-11-27 14:52:20 +01:00
parent fb57a07927
commit 1883c57c87
4 changed files with 28 additions and 0 deletions

View file

@ -424,6 +424,11 @@ describe Procedure do
expect(subject.path).to be_nil
end
end
it 'should keep types_de_champ ids stable' do
expect(subject.types_de_champ_ordered.first.id).not_to eq(procedure.types_de_champ_ordered.first.id)
expect(subject.types_de_champ_ordered.first.stable_id).to eq(procedure.types_de_champ_ordered.first.id)
end
end
describe '#publish!' do

View file

@ -39,6 +39,15 @@ shared_examples 'type_de_champ_spec' do
it { is_expected.to allow_value('blabla').for(:description) }
end
context 'stable_id' do
it {
type_de_champ = create(:type_de_champ_text)
expect(type_de_champ.id).to eq(type_de_champ.stable_id)
cloned_type_de_champ = type_de_champ.clone
expect(cloned_type_de_champ.stable_id).to eq(type_de_champ.stable_id)
}
end
context 'remove piece_justificative_template' do
context 'when the tdc is piece_justificative' do
let(:template_double) { double('template', attached?: attached, purge_later: true) }