mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Don't suggest invalid username
This commit is contained in:
@@ -93,6 +93,15 @@ describe UserNameSuggester do
|
||||
it 'should handle typical facebook usernames' do
|
||||
expect(UserNameSuggester.suggest('roger.nelson.3344913')).to eq('roger.nelson.33')
|
||||
end
|
||||
|
||||
it 'removes underscore at the end of long usernames that get truncated' do
|
||||
expect(UserNameSuggester.suggest('uuuuuuuuuuuuuu_u')).to_not end_with('_')
|
||||
end
|
||||
|
||||
it "adds number if it's too short after removing trailing underscore" do
|
||||
User.stubs(:username_length).returns(8..8)
|
||||
expect(UserNameSuggester.suggest('uuuuuuu_u')).to eq('uuuuuuu1')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user