SPEC: Add test case in emit_web_hook_event_spec for commit 4c6bfb9

This commit is contained in:
Vinoth Kannan 2019-03-31 16:28:40 +05:30
parent 8b8d528b88
commit 904ba266cf

@ -1,4 +1,5 @@
require 'rails_helper'
require 'excon'
describe Jobs::EmitWebHookEvent do
let(:post_hook) { Fabricate(:web_hook) }
@ -24,6 +25,16 @@ describe Jobs::EmitWebHookEvent do
end.to raise_error(Discourse::InvalidParameters)
end
it "should not destroy webhook event in case of error" do
Excon::Connection.any_instance.stubs(:post).raises("error")
subject.execute(
web_hook_id: post_hook.id,
payload: { id: post.id }.to_json,
event_type: WebHookEventType::POST
)
expect(WebHookEvent.last.web_hook_id).to eq(post_hook.id)
end
context 'when the web hook is failed' do
before do
SiteSetting.retry_web_hook_events = true