Add iban type de champ

This commit is contained in:
kara Diaby 2020-09-22 16:04:57 +02:00
parent a7e4720d0d
commit cb4e91c405
15 changed files with 72 additions and 1 deletions

View file

@ -155,6 +155,10 @@ FactoryBot.define do
type_de_champ { association :type_de_champ_carte, procedure: dossier.procedure }
end
factory :champ_iban, class: 'Champs::IbanChamp' do
type_de_champ { association :type_de_champ_iban, procedure: dossier.procedure }
end
factory :champ_siret, class: 'Champs::SiretChamp' do
association :type_de_champ, factory: [:type_de_champ_siret]
association :etablissement, factory: [:etablissement]

View file

@ -139,6 +139,9 @@ FactoryBot.define do
factory :type_de_champ_siret do
type_champ { TypeDeChamp.type_champs.fetch(:siret) }
end
factory :type_de_champ_iban do
type_champ { TypeDeChamp.type_champs.fetch(:iban) }
end
factory :type_de_champ_carte do
type_champ { TypeDeChamp.type_champs.fetch(:carte) }
end

View file

@ -0,0 +1,12 @@
describe Champs::IbanChamp do
describe '#valid?' do
it do
expect(build(:champ_iban, value: nil)).to be_valid
expect(build(:champ_iban, value: "FR35 KDSQFDJQSMFDQMFDQ")).to_not be_valid
expect(build(:champ_iban, value: "FR7630006000011234567890189")).to be_valid
expect(build(:champ_iban, value: "FR76 3000 6000 0112 3456 7890 189")).to be_valid
expect(build(:champ_iban, value: "FR76 3000 6000 0112 3456 7890 189DSF")).to_not be_valid
end
end
end

View file

@ -74,6 +74,7 @@ describe ProcedureExportService do
"siret",
"carte",
"titre_identite",
"iban",
"text"
]
end
@ -158,6 +159,7 @@ describe ProcedureExportService do
"siret",
"carte",
"titre_identite",
"iban",
"text"
]
end
@ -238,6 +240,7 @@ describe ProcedureExportService do
"siret",
"carte",
"titre_identite",
"iban",
"text"
]
end