From fdfb3a362a706ce2a0da7b886835e6d50fc472c1 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Tue, 15 Aug 2023 12:12:22 -0300 Subject: [PATCH] DEV: Make sure max_username_length is within MAX_USERNAME_LENGTH_RANGE (#23104) --- spec/models/username_validator_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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