docbrown/spec/models/settings/community_spec.rb
Jeremy Friesen 25f0681c4f
Validating community does not include < nor > (#15482)
If a community name has a < or > it may cause havoc when the community
attempts to send an email.

Closes #15274
2021-11-29 10:55:02 -05:00

33 lines
902 B
Ruby

require "rails_helper"
RSpec.describe Settings::Community do
describe "validating community name" do
it "does not allow '<' nor '>' character" do
expect do
described_class.community_name = "<Hiya"
end.to raise_error(/may not include the "<" nor ">"/)
expect do
described_class.community_name = "Bya>"
end.to raise_error(/may not include the "<" nor ">"/)
expect do
described_class.community_name = "Hello Folks"
end.not_to raise_error
end
end
describe "validating emojis strings" do
it "allows emoji-only strings" do
expect do
described_class.community_emoji = "💯"
end.not_to raise_error
end
it "rejects non emoji-only strings" do
expect do
described_class.community_emoji = "abc"
end.to raise_error(/contains non-emoji characters or invalid emoji/)
end
end
end