From 3a00f89aa1f2280b995512cd5f91568e6d349cc6 Mon Sep 17 00:00:00 2001 From: kyori19 Date: Sat, 20 Jul 2024 00:31:48 +0900 Subject: [PATCH] Respect `Account::DISPLAY_NAME_LENGTH_LIMIT` in account spec correctly (#31075) --- spec/models/account_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index dfb1f5bc61..5f918f159a 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -775,7 +775,7 @@ RSpec.describe Account do end it 'is invalid if the display name is longer than the character limit' do - account = Fabricate.build(:account, display_name: username_over_limit) + account = Fabricate.build(:account, display_name: display_name_over_limit) account.valid? expect(account).to model_have_error_on_field(:display_name) end @@ -821,7 +821,7 @@ RSpec.describe Account do end it 'is valid even if the display name is longer than the character limit' do - account = Fabricate.build(:account, domain: 'domain', display_name: username_over_limit) + account = Fabricate.build(:account, domain: 'domain', display_name: display_name_over_limit) account.valid? expect(account).to_not model_have_error_on_field(:display_name) end @@ -837,6 +837,10 @@ RSpec.describe Account do 'a' * described_class::USERNAME_LENGTH_LIMIT * 2 end + def display_name_over_limit + 'a' * described_class::DISPLAY_NAME_LENGTH_LIMIT * 2 + end + def account_note_over_limit 'a' * described_class::NOTE_LENGTH_LIMIT * 2 end