From fd42607c170389e7193bac9bc513ad9355461fc8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 12 Jul 2024 10:26:15 -0400 Subject: [PATCH] Use `validate_presence_of` for `Account.username` spec --- spec/models/account_spec.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 8e5648a0b0e..14528ed17bf 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -722,11 +722,7 @@ RSpec.describe Account do end describe 'validations' do - it 'is invalid without a username' do - account = Fabricate.build(:account, username: nil) - account.valid? - expect(account).to model_have_error_on_field(:username) - end + it { is_expected.to validate_presence_of(:username) } it 'squishes the username before validation' do account = Fabricate(:account, domain: nil, username: " \u3000bob \t \u00a0 \n ")