From bdd25f34ca40b3cdaff00de922b5a52348b837f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Wed, 19 Nov 2014 16:55:22 +0200 Subject: [PATCH] Contact name validation --- app/models/contact.rb | 3 +-- spec/models/contact_spec.rb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 11d538f71..c6025156f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,7 +1,6 @@ class Contact < ActiveRecord::Base # TODO: Foreign contact will get email with activation link/username/temp password # TODO: Phone number validation, in first phase very minimam in order to support current registries - # TODO: Validate presence of name include EppErrors @@ -18,7 +17,7 @@ class Contact < ActiveRecord::Base accepts_nested_attributes_for :address, :disclosure - validates :phone, :email, :ident, :address, :registrar, presence: true + validates :name, :phone, :email, :ident, :address, :registrar, presence: true validate :ident_must_be_valid diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index dcba07cd1..2d39fe391 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -21,6 +21,7 @@ describe Contact do expect(@contact.valid?).to eq false expect(@contact.errors.messages).to match_array({ + name: ['Required parameter missing - name'], phone: ['Required parameter missing - phone', 'Phone nr is invalid'], email: ['Required parameter missing - email', 'Email is invalid'], ident: ['Required parameter missing - ident'],