mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
fix intermittent failing tests, some watched word refactoring
This commit is contained in:
@ -247,9 +247,12 @@ describe PrettyText do
|
||||
end
|
||||
|
||||
it 'does censor code fences' do
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
$redis.flushall
|
||||
begin
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
ensure
|
||||
$redis.flushall
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -788,12 +791,15 @@ HTML
|
||||
end
|
||||
|
||||
it 'can censor words correctly' do
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook('yay banana yay')).not_to include('banana')
|
||||
expect(PrettyText.cook('yay `banana` yay')).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).to include("\u25a0\u25a0")
|
||||
$redis.flushall
|
||||
begin
|
||||
['apple', 'banana'].each { |w| Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor]) }
|
||||
expect(PrettyText.cook('yay banana yay')).not_to include('banana')
|
||||
expect(PrettyText.cook('yay `banana` yay')).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).not_to include('banana')
|
||||
expect(PrettyText.cook("# banana")).to include("\u25a0\u25a0")
|
||||
ensure
|
||||
$redis.flushall
|
||||
end
|
||||
end
|
||||
|
||||
it 'supports typographer' do
|
||||
|
Reference in New Issue
Block a user