BigW Consortium Gitlab

Commit f9075eb0 by Lin Jen-Shin

Add test for running hooks for pipeline after touched

parent 016d4f6b
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment