mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
Add more specs for word watcher service.
This commit is contained in:
parent
0e6d0b0f8e
commit
7cb194f2db
|
@ -48,6 +48,18 @@ describe WordWatcher do
|
|||
expect(m[1]).to eq("acknowledge")
|
||||
end
|
||||
|
||||
context "word boundary" do
|
||||
it "handles word boundary" do
|
||||
Fabricate(:watched_word, word: "love", action: WatchedWord.actions[:require_approval])
|
||||
expect(WordWatcher.new("I Love, bananas.").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
expect(WordWatcher.new("I LOVE; apples.").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
expect(WordWatcher.new("love: is a thing.").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
expect(WordWatcher.new("I love. oranges").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
expect(WordWatcher.new("I :love. pineapples").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
expect(WordWatcher.new("peace ,love and understanding.").word_matches_for_action?(:require_approval)[1]).to eq("love")
|
||||
end
|
||||
end
|
||||
|
||||
context "emojis" do
|
||||
it "handles emoji" do
|
||||
Fabricate(:watched_word, word: ":joy:", action: WatchedWord.actions[:require_approval])
|
||||
|
|
Loading…
Reference in New Issue
Block a user