fix: add presence validation for account name (#12636)

## Description

When a user tries creating a new account through the Super Admin
dashboard, and they forget to fill in the account name, they're faced
with an ugly error (generic "Something went wrong" on production).

This PR simply adds the `validates :name, presence: true` model
validation on `Account` model, which is translated as a proper error
message on the Super Admin UI.
This commit is contained in:
Gabriel Jablonski
2025-11-25 11:41:15 -03:00
committed by GitHub
parent fa07b9158a
commit e635122ff6
2 changed files with 7 additions and 0 deletions

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?