mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
SPEC: check enqueued jobs size instead of using mocks
This commit is contained in:
parent
76696b22fe
commit
bf2059baf5
|
@ -125,13 +125,20 @@ describe WebHook do
|
|||
end
|
||||
|
||||
describe 'when there are no active hooks' do
|
||||
it 'should not generate payload and enqueue anything' do
|
||||
it 'should not generate payload and enqueue anything for topic events' do
|
||||
topic_web_hook.destroy!
|
||||
post = PostCreator.create(user, raw: 'post', title: 'topic', skip_validations: true)
|
||||
expect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)
|
||||
|
||||
WebHook.expects(:generate_payload).times(0)
|
||||
PostDestroyer.new(admin, post).destroy
|
||||
expect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)
|
||||
end
|
||||
|
||||
it 'should not enqueue anything for tag events' do
|
||||
tag = Fabricate(:tag)
|
||||
tag.destroy!
|
||||
expect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -387,12 +394,6 @@ describe WebHook do
|
|||
expect(payload["id"]).to eq(tag.id)
|
||||
end
|
||||
|
||||
it 'should not generate payload if webhooks not exist' do
|
||||
WebHook.expects(:generate_payload).times(0)
|
||||
tag = Fabricate(:tag)
|
||||
tag.destroy!
|
||||
end
|
||||
|
||||
it 'should enqueue the right hooks for flag events' do
|
||||
post = Fabricate(:post)
|
||||
admin = Fabricate(:admin)
|
||||
|
|
Loading…
Reference in New Issue
Block a user