mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Move spec/components to spec/lib (#15987)
Lib specs were inexplicably split into two directories (`lib` and `components`) This moves them all into `lib`.
This commit is contained in:
27
spec/lib/validators/unicode_username_validator_spec.rb
Normal file
27
spec/lib/validators/unicode_username_validator_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe UnicodeUsernameValidator do
|
||||
subject { described_class.new }
|
||||
|
||||
it "disallows Unicode usernames when external system avatars are disabled" do
|
||||
SiteSetting.external_system_avatars_enabled = false
|
||||
|
||||
expect(subject.valid_value?("t")).to eq(false)
|
||||
expect(subject.error_message).to eq(I18n.t("site_settings.errors.unicode_usernames_avatars"))
|
||||
|
||||
expect(subject.valid_value?("f")).to eq(true)
|
||||
expect(subject.error_message).to be_blank
|
||||
end
|
||||
|
||||
it "allows Unicode usernames when external system avatars are enabled" do
|
||||
SiteSetting.external_system_avatars_enabled = true
|
||||
|
||||
expect(subject.valid_value?("t")).to eq(true)
|
||||
expect(subject.error_message).to be_blank
|
||||
|
||||
expect(subject.valid_value?("f")).to eq(true)
|
||||
expect(subject.error_message).to be_blank
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user