feat: add presence validation for account name (#117)

This commit is contained in:
Gabriel Jablonski 2025-10-10 10:30:48 -03:00 committed by GitHub
parent 6b7f96dd68
commit 96d1003548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -48,6 +48,7 @@ class Account < ApplicationRecord
check_for_column: false
}.freeze
validates :name, presence: true
validates :domain, length: { maximum: 100 }
validates_with JsonSchemaValidator,
schema: SETTINGS_PARAMS_SCHEMA,

View File

@ -22,6 +22,12 @@ RSpec.describe Account do
describe 'length validations' do
let(:account) { create(:account) }
it 'validates name presence' do
account.name = ''
account.valid?
expect(account.errors[:name]).to include("can't be blank")
end
it 'validates name length' do
account.name = 'a' * 256
account.valid?