Respect `Account::DISPLAY_NAME_LENGTH_LIMIT` in account spec correctly (#31075)

This commit is contained in:
kyori19 2024-07-20 00:31:48 +09:00 committed by GitHub
parent e768b23aa9
commit 3a00f89aa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -775,7 +775,7 @@ RSpec.describe Account do
end end
it 'is invalid if the display name is longer than the character limit' do 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? account.valid?
expect(account).to model_have_error_on_field(:display_name) expect(account).to model_have_error_on_field(:display_name)
end end
@ -821,7 +821,7 @@ RSpec.describe Account do
end end
it 'is valid even if the display name is longer than the character limit' do 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? account.valid?
expect(account).to_not model_have_error_on_field(:display_name) expect(account).to_not model_have_error_on_field(:display_name)
end end
@ -837,6 +837,10 @@ RSpec.describe Account do
'a' * described_class::USERNAME_LENGTH_LIMIT * 2 'a' * described_class::USERNAME_LENGTH_LIMIT * 2
end end
def display_name_over_limit
'a' * described_class::DISPLAY_NAME_LENGTH_LIMIT * 2
end
def account_note_over_limit def account_note_over_limit
'a' * described_class::NOTE_LENGTH_LIMIT * 2 'a' * described_class::NOTE_LENGTH_LIMIT * 2
end end