DEV: Make sure max_username_length is within MAX_USERNAME_LENGTH_RANGE (#23104)

This commit is contained in:
Roman Rizzi 2023-08-15 12:12:22 -03:00 committed by GitHub
parent ee61fe5a2b
commit fdfb3a362a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -27,7 +27,12 @@ RSpec.describe UsernameValidator do
end
end
let(:max_username_length) { User.maximum("length(username)") }
let(:max_username_length) do
[
User.maximum("length(username)"),
MaxUsernameLengthValidator::MAX_USERNAME_LENGTH_RANGE.begin,
].max
end
let(:min_username_length) { User.minimum("length(username)") }
shared_examples "ASCII username" do