mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:07:53 +08:00
30 lines
646 B
Ruby
30 lines
646 B
Ruby
require 'spec_helper'
|
|
|
|
describe SpamRulesEnforcer do
|
|
|
|
before do
|
|
SystemMessage.stubs(:create)
|
|
end
|
|
|
|
describe 'enforce!' do
|
|
context 'post argument' do
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:post)) }
|
|
|
|
it 'performs the FlagSockpuppetRule' do
|
|
SpamRule::FlagSockpuppets.any_instance.expects(:perform).once
|
|
enforce
|
|
end
|
|
end
|
|
|
|
context 'user argument' do
|
|
subject(:enforce) { described_class.enforce!(Fabricate.build(:user)) }
|
|
|
|
it 'performs the AutoBlock' do
|
|
SpamRule::AutoBlock.any_instance.expects(:perform).once
|
|
enforce
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|