2015-10-11 17:41:23 +08:00
|
|
|
require 'rails_helper'
|
2013-05-31 23:41:40 +08:00
|
|
|
|
|
|
|
describe SpamRulesEnforcer do
|
|
|
|
|
2013-07-03 02:42:30 +08:00
|
|
|
before do
|
|
|
|
SystemMessage.stubs(:create)
|
|
|
|
end
|
|
|
|
|
2013-10-26 01:25:02 +08:00
|
|
|
describe 'enforce!' do
|
|
|
|
context 'post argument' do
|
|
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:post)) }
|
2013-05-31 23:41:40 +08:00
|
|
|
|
2013-10-26 01:25:02 +08:00
|
|
|
it 'performs the FlagSockpuppetRule' do
|
|
|
|
SpamRule::FlagSockpuppets.any_instance.expects(:perform).once
|
|
|
|
enforce
|
2013-10-12 01:33:23 +08:00
|
|
|
end
|
2013-05-31 23:41:40 +08:00
|
|
|
end
|
|
|
|
|
2013-10-26 01:25:02 +08:00
|
|
|
context 'user argument' do
|
|
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:user)) }
|
2013-05-31 23:41:40 +08:00
|
|
|
|
2017-11-11 01:18:08 +08:00
|
|
|
it 'performs the AutoSilence' do
|
|
|
|
SpamRule::AutoSilence.any_instance.expects(:perform).once
|
2013-10-26 01:25:02 +08:00
|
|
|
enforce
|
2013-05-31 23:41:40 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|