mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Use Estonian reference number format instead of ISO 11649
This commit is contained in:
parent
aa6e8f8a93
commit
5738c17731
25 changed files with 244 additions and 47 deletions
|
@ -6,7 +6,7 @@ class RegistrarTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_valid
|
||||
assert @registrar.valid?
|
||||
assert @registrar.valid?, proc { @registrar.errors.full_messages }
|
||||
end
|
||||
|
||||
def test_invalid_without_name
|
||||
|
@ -55,8 +55,28 @@ class RegistrarTest < ActiveSupport::TestCase
|
|||
assert_equal 'Main Street, New York, New York, 12345', @registrar.address
|
||||
end
|
||||
|
||||
def test_reference_number_generation
|
||||
@registrar.validate
|
||||
refute_empty @registrar.reference_no
|
||||
def test_validates_reference_number_format
|
||||
@registrar.reference_no = '1'
|
||||
assert @registrar.invalid?
|
||||
|
||||
@registrar.reference_no = '11'
|
||||
assert @registrar.valid?
|
||||
|
||||
@registrar.reference_no = '1' * 20
|
||||
assert @registrar.valid?
|
||||
|
||||
@registrar.reference_no = '1' * 21
|
||||
assert @registrar.invalid?
|
||||
|
||||
@registrar.reference_no = '1a'
|
||||
assert @registrar.invalid?
|
||||
end
|
||||
|
||||
def test_disallows_non_unique_reference_numbers
|
||||
registrars(:bestnames).update!(reference_no: '1234')
|
||||
|
||||
assert_raises ActiveRecord::RecordNotUnique do
|
||||
registrars(:goodnames).update!(reference_no: '1234')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue