about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-06-12 16:39:30 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-06-12 16:39:30 -0500
commite931cf656d1de6d89b5b048d8f1de15be7b52690 (patch)
treeb1c0c66b6a88b56c422ea8be1dbef77e42afae72 /spec/models
parent97d2df77aae687c983c1294ebcd3962e4f9d985c (diff)
parent34f1fd2a621ca869c17009487e2f10063812fbd0 (diff)
Merge remote-tracking branch 'glitchsoc/master' into 454-allow-keyword-mutes-to-skip-mentions
  Conflicts:
 	app/models/glitch/keyword_mute.rb
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/glitch/keyword_mute_spec.rb8
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 de1376e4c..58c9d89df 100644
--- a/spec/models/glitch/keyword_mute_spec.rb
+++ b/spec/models/glitch/keyword_mute_spec.rb
@@ -81,12 +81,18 @@ RSpec.describe Glitch::KeywordMute, type: :model do
         expect(matcher.matches?('(hot take)', Unscoped)).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)', Unscoped)).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')