mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
17 lines
486 B
Ruby
17 lines
486 B
Ruby
# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
|
|
RSpec.shared_examples 'iso31661_alpha2' do
|
|
describe 'validation' do
|
|
it 'rejects invalid' do
|
|
model.send("#{attribute}=", 'invalid')
|
|
model.validate
|
|
expect(model.errors).to be_added(attribute, :invalid_iso31661_alpha2)
|
|
end
|
|
|
|
it 'accepts valid' do
|
|
model.send("#{attribute}=", 'US')
|
|
model.validate
|
|
expect(model.errors).to_not be_added(attribute, :invalid_iso31661_alpha2)
|
|
end
|
|
end
|
|
end
|