Prevent occasional matching on random name by specifying one (#14087)
We could mistakenly be picking up matches on user "name" rather than user username due to faker giving a name like "Gale" or "Haley" or "Annalee" which match the search term "ale". Give an explicitly non-matching pattern for the name string to prevent this. Sampling from Faker::Name.name and filtering for case insensitive matching against the search term shows slightly higher than 1% of results will match this "ale" triple. Low enough to go unnoticed for a long time.
This commit is contained in:
parent
b9b1becbe3
commit
d585ae2bf8
1 changed files with 1 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ RSpec.describe Search::Username, type: :service do
|
|||
it "finds multiple users whose names have common parts", :aggregate_failures do
|
||||
alex = create(:user, username: "alex")
|
||||
alexsmith = create(:user, name: "alexsmith")
|
||||
rhymes = create(:user, username: "rhymes")
|
||||
rhymes = create(:user, username: "rhymes", name: "Non-matching Name")
|
||||
|
||||
result = described_class.search_documents("ale")
|
||||
usernames = result.pluck(:username)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue