mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
26 lines
834 B
Ruby
26 lines
834 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.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
|