DEV: Add some description to help with understanding flakey test failures (#22772)

This commit is contained in:
Natalie Tay 2023-07-25 15:14:08 +08:00 committed by GitHub
parent f380643528
commit 72bc3ae9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -25,16 +25,19 @@ RSpec.describe MaxUsernameLengthValidator do
end
it "checks for users with short usernames" do
user = Fabricate(:user, username: "jackjackjack")
username = "jackjackjack"
Fabricate(:user, username: username)
validator = described_class.new
expect(validator.valid_value?(12)).to eq(true)
expect(validator.valid_value?(12)).to eq(true),
"Valid as 12 >= #{SiteSetting.min_username_length}"
validator = described_class.new
expect(validator.valid_value?(11)).to eq(false)
expect(validator.valid_value?(11)).to eq(false),
"Invalid as 11 < #{SiteSetting.min_username_length}"
expect(validator.error_message).to eq(
I18n.t("site_settings.errors.max_username_length_exists", username: "jackjackjack"),
I18n.t("site_settings.errors.max_username_length_exists", username: username),
)
end
end