|
|
@ -79,12 +79,18 @@ RSpec.describe Glitch::KeywordMute, type: :model do
|
|
|
|
expect(matcher.matches?('(hot take)')).to be_truthy
|
|
|
|
expect(matcher.matches?('(hot take)')).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'escapes metacharacters in keywords' do
|
|
|
|
it 'escapes metacharacters in whole-word keywords' do
|
|
|
|
Glitch::KeywordMute.create!(account: alice, keyword: '(hot take)')
|
|
|
|
Glitch::KeywordMute.create!(account: alice, keyword: '(hot take)')
|
|
|
|
|
|
|
|
|
|
|
|
expect(matcher.matches?('(hot take)')).to be_truthy
|
|
|
|
expect(matcher.matches?('(hot take)')).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'escapes metacharacters in non-whole-word keywords' do
|
|
|
|
|
|
|
|
Glitch::KeywordMute.create!(account: alice, keyword: '(-', whole_word: false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(matcher.matches?('bad (-)')).to be_truthy
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it 'uses case-folding rules appropriate for more than just English' do
|
|
|
|
it 'uses case-folding rules appropriate for more than just English' do
|
|
|
|
Glitch::KeywordMute.create!(account: alice, keyword: 'großeltern')
|
|
|
|
Glitch::KeywordMute.create!(account: alice, keyword: 'großeltern')
|
|
|
|
|
|
|
|
|
|
|
|