Spec test to make sure we do not skip trashed post

This commit is contained in:
Vinoth Kannan 2018-02-13 12:23:47 +05:30
parent cc3cf6588b
commit e924de71e7
1 changed files with 10 additions and 0 deletions

View File

@ -67,6 +67,16 @@ describe Jobs::EmitWebHookEvent do
end.not_to raise_error
end
it 'should not skip trashed post' do
stub_request(:post, "https://meta.discourse.org/webhook_listener")
.to_return(body: 'OK', status: 200)
expect do
post.trash!
subject.execute(web_hook_id: post_hook.id, event_type: 'post', post_id: post.id)
end.to change(WebHookEvent, :count).by(1)
end
it 'sets up proper request headers' do
stub_request(:post, "https://meta.discourse.org/webhook_listener")
.to_return(headers: { test: 'string' }, body: 'OK', status: 200)