about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-10-14 02:28:20 -0500
committerDavid Yip <yipdw@member.fsf.org>2017-10-21 14:54:21 -0500
commit4745d6eeca3a422f41775ee5f31989fc036da7d6 (patch)
tree4c04ca2eca3f03d20d51374d2c37b12f8bb6962a /spec
parent9093e2de7a133470eec1049a13465f81928d0119 (diff)
Spec out KeywordMute interface. #164.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/keyword_mute_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/models/keyword_mute_spec.rb b/spec/models/keyword_mute_spec.rb
index cd0881565..cb6e554e4 100644
--- a/spec/models/keyword_mute_spec.rb
+++ b/spec/models/keyword_mute_spec.rb
@@ -1,5 +1,21 @@
 require 'rails_helper'
 
 RSpec.describe KeywordMute, type: :model do
-  pending "add some examples to (or delete) #{__FILE__}"
+  describe '.matches?' do
+    let(:alice)  { Fabricate(:account, username: 'alice').tap(&:save!) }
+    let(:status) { Fabricate(:status, account: alice).tap(&:save!) }
+    let(:keyword_mute) { Fabricate(:keyword_mute, account: alice, keyword: 'take').tap(&:save!) }
+
+    it 'returns true if any keyword in the set matches the status text' do
+      status.update_attribute(:text, 'This is a hot take')
+
+      expect(KeywordMute.where(account: alice).matches?(status.text)).to be_truthy
+    end
+
+    it 'returns false if no keyword in the set matches the status text'
+
+    describe 'matching' do
+      it 'is case-insensitive'
+    end
+  end
 end