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