2020-09-22 16:04:57 +02:00
|
|
|
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
|
2022-10-06 15:49:34 +02:00
|
|
|
expect(build(:champ_iban, value: "FR76 3000 6000 0112 3456 7890 189")).to be_valid
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'format value after validation' do
|
|
|
|
champ = build(:champ_iban, value: "FR76 3000 6000 0112 3456 7890 189")
|
|
|
|
champ.valid?
|
|
|
|
expect(champ.value).to eq("FR76 3000 6000 0112 3456 7890 189")
|
2020-09-22 16:04:57 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|