mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 13:16:26 +08:00
SPEC: Add test case in emit_web_hook_event_spec for commit 4c6bfb9
This commit is contained in:
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user