mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
FIX: Make sure censored words are on boundaries in topic titles
This commit is contained in:
parent
c1560d8195
commit
b93edc9945
2 changed files with 10 additions and 2 deletions
|
@ -34,7 +34,7 @@ describe Topic do
|
|||
it 'should not be valid' do
|
||||
SiteSetting.censored_words = 'pineapple|pen'
|
||||
|
||||
topic.title = 'pen PinEapple apple pen '
|
||||
topic.title = 'pen PinEapple apple pen is a complete sentence'
|
||||
|
||||
expect(topic).to_not be_valid
|
||||
|
||||
|
@ -44,6 +44,14 @@ describe Topic do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'titles with censored words not on boundaries' do
|
||||
it "should be valid" do
|
||||
SiteSetting.censored_words = 'apple'
|
||||
topic.title = "Pineapples are great fruit! Applebee's is a great restaurant"
|
||||
expect(topic).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when title does not contain censored words' do
|
||||
it 'should be valid' do
|
||||
topic.title = 'The cake is a lie'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue