diff options
author | David Yip <yipdw@member.fsf.org> | 2018-06-05 21:38:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 21:38:04 -0500 |
commit | 68373e799bc6e289ba6c2ced5d0da376ad1cdb3a (patch) | |
tree | e5729bbe640156e20005bfc9b46a7527475c2c53 /spec | |
parent | f009fef40b78b31e9c34e85dca4629e32aa4daa0 (diff) | |
parent | a640c322c19013647cbd19ac907dd18b57c2b1b8 (diff) |
Merge pull request #534 from glitch-soc/restructure-kw-as-word-lists
Escape metacharacters in non-whole-word keyword mutes (#463, #533)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/glitch/keyword_mute_spec.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/models/glitch/keyword_mute_spec.rb b/spec/models/glitch/keyword_mute_spec.rb index 79225e3b9..443832ac7 100644 --- a/spec/models/glitch/keyword_mute_spec.rb +++ b/spec/models/glitch/keyword_mute_spec.rb @@ -79,12 +79,18 @@ RSpec.describe Glitch::KeywordMute, type: :model do expect(matcher.matches?('(hot take)')).to be_truthy end - it 'escapes metacharacters in keywords' do + it 'escapes metacharacters in whole-word keywords' do Glitch::KeywordMute.create!(account: alice, keyword: '(hot take)') expect(matcher.matches?('(hot take)')).to be_truthy 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 Glitch::KeywordMute.create!(account: alice, keyword: 'großeltern') |