2
0

Add ability to block words in usernames (#35407)

This commit is contained in:
Eugen Rochko
2025-07-29 12:19:15 +02:00
committed by GitHub
parent 8cf7a77808
commit 20bbd20ef1
28 changed files with 560 additions and 34 deletions

View File

@@ -10,8 +10,13 @@ RSpec.describe UnreservedUsernameValidator do
attr_accessor :username
validates_with UnreservedUsernameValidator
def self.name
'Foo'
end
end
end
let(:record) { record_class.new }
describe '#validate' do
@@ -114,7 +119,7 @@ RSpec.describe UnreservedUsernameValidator do
end
def stub_reserved_usernames(value)
allow(Setting).to receive(:[]).with('reserved_usernames').and_return(value)
value&.each { |str| Fabricate(:username_block, username: str, exact: true) }
end
end
end