Sha256: 620522974929825628ab99ce94bb95d52563dc791115fcfe8cbddcb2060d7521
Contents?: true
Size: 928 Bytes
Versions: 1
Compression:
Stored size: 928 Bytes
Contents
describe 'NIF validation' do it 'passes for valid NIFs' do expect(Citizenship.valid_nif?('123456789')).to be_truthy expect(Citizenship.valid_nif!('123456789')).to eq('123456789') expect(Citizenship.valid_nif!('123456789')).to eq('123456789') end it 'fails on invalid NIFs' do expect(Citizenship.valid_nif?('223456789')).to be_falsy expect(Citizenship.valid_nif?('12345678')).to be_falsy expect { Citizenship.valid_nif!('223456789') }.to raise_error(Citizenship::Error) expect(Citizenship.valid_nif?(nil)).to be_falsy end it 'strict validation disallow whitspaces and others' do expect(Citizenship.valid_nif?(' 123456789', strict: true)).to be_falsy expect(Citizenship.valid_nif?('123456789 ', strict: true)).to be_falsy expect(Citizenship.valid_nif?('12345 6789', strict: true)).to be_falsy expect(Citizenship.valid_nif?('123456789', strict: true)).to be_truthy end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
citizenship-1.0.0 | spec/citizenship/nif_spec.rb |