diff --git a/spec/models/username_validator_spec.rb b/spec/models/username_validator_spec.rb index 70d36c269cb..4e68592ac67 100644 --- a/spec/models/username_validator_spec.rb +++ b/spec/models/username_validator_spec.rb @@ -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