This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-10-09 15:28:28 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe KeywordMute, type: :model do
|
2017-10-14 00:28:20 -07:00
|
|
|
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
|
2017-10-09 15:28:28 -07:00
|
|
|
end
|