2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2013-05-31 11:41:40 -04:00
|
|
|
|
|
|
|
describe SpamRulesEnforcer do
|
|
|
|
|
2013-07-02 14:42:30 -04:00
|
|
|
before do
|
|
|
|
SystemMessage.stubs(:create)
|
|
|
|
end
|
|
|
|
|
2013-10-25 13:25:02 -04:00
|
|
|
describe 'enforce!' do
|
|
|
|
context 'post argument' do
|
|
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:post)) }
|
2013-05-31 11:41:40 -04:00
|
|
|
|
2013-10-25 13:25:02 -04:00
|
|
|
it 'performs the FlagSockpuppetRule' do
|
|
|
|
SpamRule::FlagSockpuppets.any_instance.expects(:perform).once
|
|
|
|
enforce
|
2013-10-11 13:33:23 -04:00
|
|
|
end
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
|
2013-10-25 13:25:02 -04:00
|
|
|
context 'user argument' do
|
|
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:user)) }
|
2013-05-31 11:41:40 -04:00
|
|
|
|
2013-10-25 13:25:02 -04:00
|
|
|
it 'performs the AutoBlock' do
|
|
|
|
SpamRule::AutoBlock.any_instance.expects(:perform).once
|
|
|
|
enforce
|
2013-05-31 11:41:40 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|