Skip to content
Snippets Groups Projects
Commit f9075eb0 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Add test for running hooks for pipeline after touched

parent 016d4f6b
Branches
Tags
1 merge request!5525Implement Slack integration for pipeline hooks
Pipeline #
Loading
Loading
@@ -542,4 +542,33 @@ describe Ci::Pipeline, models: true do
end
end
end
describe '#execute_hooks' do
let!(:hook) do
create(:project_hook, project: project, pipeline_events: enabled)
end
let(:enabled) { raise NotImplementedError }
before do
WebMock.stub_request(:post, hook.url)
pipeline.touch
ProjectWebHookWorker.drain
end
context 'with pipeline hooks enabled' do
let(:enabled) { true }
it 'executes pipeline_hook after touched' do
expect(WebMock).to have_requested(:post, hook.url).once
end
end
context 'with pipeline hooks disabled' do
let(:enabled) { false }
it 'did not execute pipeline_hook after touched' do
expect(WebMock).not_to have_requested(:post, hook.url)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment