mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 19:48:28 +02:00
Add contact tests
This commit is contained in:
parent
fc869b167c
commit
738785fcb9
1 changed files with 35 additions and 0 deletions
35
test/models/contact_test.rb
Normal file
35
test/models/contact_test.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@contact = contacts(:john)
|
||||
@original_address_processing_setting = Setting.address_processing
|
||||
end
|
||||
|
||||
def teardown
|
||||
Setting.address_processing = @original_address_processing_setting
|
||||
end
|
||||
|
||||
def test_valid_fixture
|
||||
assert @contact.valid?
|
||||
end
|
||||
|
||||
def test_email_validation
|
||||
@contact.email = ''
|
||||
assert @contact.invalid?
|
||||
|
||||
@contact.email = 'test@bestmail.test'
|
||||
assert @contact.valid?
|
||||
end
|
||||
|
||||
def test_phone_validation
|
||||
@contact.phone = ''
|
||||
assert @contact.invalid?
|
||||
|
||||
@contact.phone = '+123.'
|
||||
assert @contact.invalid?
|
||||
|
||||
@contact.phone = '+123.4'
|
||||
assert @contact.valid?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue