mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
0f4beab0fb
This enables cops related to RSpec `subject`. See https://github.com/discourse/rubocop-discourse/pull/32
26 lines
862 B
Ruby
26 lines
862 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe UnicodeUsernameValidator do
|
|
subject(:validator) { described_class.new }
|
|
|
|
it "disallows Unicode usernames when external system avatars are disabled" do
|
|
SiteSetting.external_system_avatars_enabled = false
|
|
|
|
expect(validator.valid_value?("t")).to eq(false)
|
|
expect(validator.error_message).to eq(I18n.t("site_settings.errors.unicode_usernames_avatars"))
|
|
|
|
expect(validator.valid_value?("f")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
end
|
|
|
|
it "allows Unicode usernames when external system avatars are enabled" do
|
|
SiteSetting.external_system_avatars_enabled = true
|
|
|
|
expect(validator.valid_value?("t")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
|
|
expect(validator.valid_value?("f")).to eq(true)
|
|
expect(validator.error_message).to be_blank
|
|
end
|
|
end
|