about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-02-10 10:32:14 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-02-10 10:36:16 -0600
commitf1f67c46c5b369476090429a46dbc646d772ae25 (patch)
tree2150d21584c788f9e69dd930dd5ec531d6ab6c41 /spec
parent9105b0c95428e3bbecd6f8ad106508095eed5643 (diff)
Use Html2Text to generate plaintext for keyword mutes. #236.
This allows us to match URLs inside link hrefs.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/glitch/keyword_mute_helper_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/models/glitch/keyword_mute_helper_spec.rb b/spec/models/glitch/keyword_mute_helper_spec.rb
index 9d09e58da..b3f991d5b 100644
--- a/spec/models/glitch/keyword_mute_helper_spec.rb
+++ b/spec/models/glitch/keyword_mute_helper_spec.rb
@@ -39,5 +39,12 @@ RSpec.describe Glitch::KeywordMuteHelper do
 
       expect(helper.matches?(status)).to be true
     end
+
+    it 'matches link hrefs in HTML text' do
+      status = Fabricate(:status, text: '<p><a href="https://example.com/it-was-milk">yep</a></p>')
+      Glitch::KeywordMute.create!(account: alice, keyword: 'milk')
+
+      expect(helper.matches?(status)).to be true
+    end
   end
 end