[#1421] Use delegation rather than STI for TypeDeChamp

This commit is contained in:
Frederic Merizen 2018-09-11 18:57:51 +02:00
parent 4bb00e9875
commit 9beaa293cd
26 changed files with 82 additions and 65 deletions

View file

@ -3,7 +3,7 @@ describe '2018_05_14_add_annotation_privee_to_procedure' do
let!(:procedure) do
procedure = create(:procedure)
10.times do |i|
TypesDeChamp::NumberTypeDeChamp.create(
TypeDeChamp.create(
procedure: procedure,
private: false,
libelle: 'libelle',
@ -11,7 +11,7 @@ describe '2018_05_14_add_annotation_privee_to_procedure' do
type_champ: 'number'
)
TypesDeChamp::NumberTypeDeChamp.create(
TypeDeChamp.create(
procedure: procedure,
private: true,
libelle: 'libelle',

View file

@ -95,7 +95,7 @@ describe '2018_07_31_nutriscore' do
context 'with champ type mismatch' do
let!(:type_champ_to) { create(:type_de_champ_text, order_place: 1, libelle: 'texte', procedure: proc_to) }
it { expect { run_task }.to raise_exception(/incorrect type TypesDeChamp::TextareaTypeDeChamp \(expected TypesDeChamp::TextTypeDeChamp\), incorrect type champ textarea \(expected text\)$/) }
it { expect { run_task }.to raise_exception(/incorrect type champ textarea \(expected text\)$/) }
end
context 'with champ mandatoriness mismatch' do
@ -114,13 +114,13 @@ describe '2018_07_31_nutriscore' do
context 'with siret mismatch on source' do
let!(:type_champ_siret_from) { create(:type_de_champ_textarea, order_place: 2, libelle: 'Numéro SIRET', procedure: proc_from) }
it { expect { run_task }.to raise_exception(/incorrect type TypesDeChamp::TextareaTypeDeChamp \(expected TypesDeChamp::TextTypeDeChamp\), incorrect type champ textarea \(expected text\)$/) }
it { expect { run_task }.to raise_exception(/incorrect type champ textarea \(expected text\)$/) }
end
context 'with siret mismatch on destination' do
let!(:type_champ_siret_to) { create(:type_de_champ_text, order_place: 2, libelle: 'Numéro SIRET', procedure: proc_to) }
it { expect { run_task }.to raise_exception(/incorrect type TypesDeChamp::TextTypeDeChamp \(expected TypesDeChamp::SiretTypeDeChamp\), incorrect type champ text \(expected siret\)$/) }
it { expect { run_task }.to raise_exception(/incorrect type champ text \(expected siret\)$/) }
end
end
end