mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Basic ident and phone validations
This commit is contained in:
parent
256f564327
commit
1645b3e96f
6 changed files with 45 additions and 3 deletions
|
@ -17,10 +17,10 @@
|
|||
<contact:cc>EE</contact:cc>
|
||||
</contact:addr>
|
||||
</contact:postalInfo>
|
||||
<contact:voice x="1234">+1.7035555555</contact:voice>
|
||||
<contact:voice x="1234">+123.7035555555</contact:voice>
|
||||
<contact:fax>+1.7035555556</contact:fax>
|
||||
<contact:email>jdoe@example.com</contact:email>
|
||||
<contact:ident>12345678901</contact:ident>
|
||||
<contact:ident>37605030299</contact:ident>
|
||||
<contact:authInfo>
|
||||
<contact:pw>2fooBAR</contact:pw>
|
||||
</contact:authInfo>
|
||||
|
|
6
spec/fabricators/contact_fabricator.rb
Normal file
6
spec/fabricators/contact_fabricator.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
Fabricator(:contact) do
|
||||
name Faker::Name.name
|
||||
phone '+372.12345678'
|
||||
email Faker::Internet.email
|
||||
ident '37605030299'
|
||||
end
|
|
@ -2,4 +2,26 @@ require "rails_helper"
|
|||
|
||||
describe Contact do
|
||||
it { should have_many(:addresses) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before(:each) { @contact = Fabricate(:contact) }
|
||||
|
||||
it 'phone should return false' do
|
||||
@contact.phone = "32341"
|
||||
expect(@contact.valid?).to be false
|
||||
end
|
||||
|
||||
it 'ident should return false' do
|
||||
@contact.ident = "123abc"
|
||||
expect(@contact.valid?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before(:each) { @contact = Fabricate(:contact) }
|
||||
|
||||
it 'should return true' do
|
||||
expect(@contact.valid?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue