fix: Standardize name validation on agent / profile pages (#1720)

This commit is contained in:
Karthik Sivadas 2021-02-04 20:08:46 +05:30 committed by GitHub
parent 6a614a520b
commit 2012aab1d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 2 deletions

View file

@ -102,7 +102,7 @@ export default {
validations: {
agentName: {
required,
minLength: minLength(4),
minLength: minLength(1),
},
agentEmail: {
required,

View file

@ -112,7 +112,7 @@ export default {
validations: {
agentName: {
required,
minLength: minLength(4),
minLength: minLength(1),
},
agentType: {
required,

View file

@ -136,6 +136,7 @@ export default {
validations: {
name: {
required,
minLength: minLength(1),
},
displayName: {},
email: {

View file

@ -62,6 +62,7 @@ class User < ApplicationRecord
# validates_uniqueness_of :email, scope: :account_id
validates :email, :name, presence: true
validates_length_of :name, minimum: 1
has_many :account_users, dependent: :destroy
has_many :accounts, through: :account_users

View file

@ -9,6 +9,7 @@ RSpec.describe User do
context 'validations' do
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_length_of(:name).is_at_least(1) }
end
context 'associations' do