mirror of
https://github.com/discourse/discourse.git
synced 2025-01-21 06:23:01 +08:00
fix user_controller_spec when testing too long usernames
This commit is contained in:
parent
c9321cae7f
commit
7ef7208c66
|
@ -637,7 +637,7 @@ describe UsersController do
|
||||||
|
|
||||||
context 'is too long' do
|
context 'is too long' do
|
||||||
before do
|
before do
|
||||||
xhr :get, :check_username, username: 'abcdefghijklmnop'
|
xhr :get, :check_username, username: generate_username(User.username_length.last + 1)
|
||||||
end
|
end
|
||||||
include_examples 'checking an invalid username'
|
include_examples 'checking an invalid username'
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,11 @@ def create_post(args={})
|
||||||
PostCreator.create(user, args)
|
PostCreator.create(user, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_username(length=10)
|
||||||
|
range = [*'a'..'z']
|
||||||
|
Array.new(length){range.sample}.join
|
||||||
|
end
|
||||||
|
|
||||||
module MessageBus::DiagnosticsHelper
|
module MessageBus::DiagnosticsHelper
|
||||||
def publish(channel, data, opts = nil)
|
def publish(channel, data, opts = nil)
|
||||||
id = super(channel, data, opts)
|
id = super(channel, data, opts)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user