about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/keyword_mute_spec.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/models/keyword_mute_spec.rb b/spec/models/keyword_mute_spec.rb
index de5d32bb4..c74505188 100644
--- a/spec/models/keyword_mute_spec.rb
+++ b/spec/models/keyword_mute_spec.rb
@@ -30,10 +30,16 @@ RSpec.describe KeywordMute, type: :model do
         expect(matcher =~ 'This is a hot take').to be_falsy
       end
 
-      it 'does not match substrings matching keywords' do
-        KeywordMute.create!(account: alice, keyword: 'take')
+      it 'considers word boundaries when matching' do
+        KeywordMute.create!(account: alice, keyword: 'bob', whole_word: true)
+
+        expect(matcher =~ 'bobcats').to be_falsy
+      end
+
+      it 'matches substrings if whole_word is false' do
+        KeywordMute.create!(account: alice, keyword: 'take', whole_word: false)
 
-        expect(matcher =~ 'This is a shiitake mushroom').to be_falsy
+        expect(matcher =~ 'This is a shiitake mushroom').to be_truthy
       end
 
       it 'matches keywords at the beginning of the text' do