mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
parent
cee51e1ac5
commit
0f6a47d73d
47 changed files with 644 additions and 640 deletions
29
test/models/registrar/code_test.rb
Normal file
29
test/models/registrar/code_test.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarCodeTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@registrar = registrars(:bestnames).dup
|
||||
end
|
||||
|
||||
def test_registrar_is_invalid_without_code
|
||||
@registrar.code = ''
|
||||
assert @registrar.invalid?
|
||||
end
|
||||
|
||||
def test_special_code_validation
|
||||
@registrar.code = 'CID'
|
||||
assert @registrar.invalid?
|
||||
assert_includes @registrar.errors.full_messages, 'Code is forbidden'
|
||||
end
|
||||
|
||||
def test_cannot_be_changed_once_registrar_is_created
|
||||
registrar = registrars(:bestnames)
|
||||
registrar.update!(code: 'new-code')
|
||||
refute_equal 'new-code', registrar.code
|
||||
end
|
||||
|
||||
def test_normalization
|
||||
@registrar.code = 'with spaces:and:colon.'
|
||||
assert_equal 'WITHSPACESANDCOLON.', @registrar.code
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue