mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Check for group name availability should skip reserved usernames.
This commit is contained in:
@@ -15,6 +15,7 @@ describe UsernameCheckerService do
|
||||
result = @service.check_username('a', @nil_email)
|
||||
expect(result).to have_key(:errors)
|
||||
end
|
||||
|
||||
it 'rejects too long usernames' do
|
||||
result = @service.check_username('a123456789b123456789c123456789', @nil_email)
|
||||
expect(result).to have_key(:errors)
|
||||
@@ -29,6 +30,23 @@ describe UsernameCheckerService do
|
||||
result = @service.check_username('.vincent', @nil_email)
|
||||
expect(result).to have_key(:errors)
|
||||
end
|
||||
|
||||
describe 'reserved usernames' do
|
||||
before do
|
||||
SiteSetting.reserved_usernames = 'test|donkey'
|
||||
end
|
||||
|
||||
it 'rejects usernames that are reserved' do
|
||||
result = @service.check_username("test", @nil_email)
|
||||
expect(result[:available]).to eq(false)
|
||||
end
|
||||
|
||||
it 'allows reserved username checker to be skipped' do
|
||||
@service = UsernameCheckerService.new(allow_reserved_username: true)
|
||||
result = @service.check_username("test", @nil_email)
|
||||
expect(result[:available]).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'username not available locally' do
|
||||
|
||||
Reference in New Issue
Block a user