mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Validate contact and invoice emails when they change #2745
This commit is contained in:
parent
c482a3e46d
commit
6ca53f946a
7 changed files with 43 additions and 2 deletions
|
@ -109,6 +109,12 @@ describe Contact do
|
|||
it 'should have no related domain descriptions' do
|
||||
@contact.related_domain_descriptions.should == {}
|
||||
end
|
||||
|
||||
it 'should fully validate email syntax for new records' do
|
||||
@contact.email = 'not@correct'
|
||||
@contact.valid?
|
||||
@contact.errors[:email].should == ['Email is invalid']
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
|
@ -247,6 +253,14 @@ describe Contact do
|
|||
contact = @domain.contacts.first
|
||||
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] }
|
||||
end
|
||||
|
||||
it 'should fully validate email syntax for old records' do
|
||||
old = @contact.email
|
||||
@contact.email = 'legacy@support-not-correct'
|
||||
@contact.valid?
|
||||
@contact.errors[:email].should == ['Email is invalid']
|
||||
@contact.email = old
|
||||
end
|
||||
end
|
||||
|
||||
context 'as birthday' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue