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'],