diff options
Diffstat (limited to 'spec/services/web_hook_service_spec.rb')
-rw-r--r-- | spec/services/web_hook_service_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb index 259f5156d42..89346353db2 100644 --- a/spec/services/web_hook_service_spec.rb +++ b/spec/services/web_hook_service_spec.rb @@ -171,6 +171,23 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, end end + context 'with SystemHook' do + let_it_be(:system_hook) { create(:system_hook) } + let(:service_instance) { described_class.new(system_hook, data, :push_hooks) } + + before do + stub_full_request(system_hook.url, method: :post) + end + + it 'POSTs to the webhook URL with correct headers' do + service_instance.execute + + expect(WebMock).to have_requested(:post, stubbed_hostname(system_hook.url)).with( + headers: headers.merge({ 'X-Gitlab-Event' => 'System Hook' }) + ).once + end + end + it 'POSTs the data as JSON and returns expected headers' do stub_full_request(project_hook.url, method: :post) |