BigW Consortium Gitlab

Commit 77540619 by Lin Jen-Shin

Test against the status in the payload

parent 9e06bde2
...@@ -567,6 +567,12 @@ describe Ci::Pipeline, models: true do ...@@ -567,6 +567,12 @@ describe Ci::Pipeline, models: true do
create(:ci_build, :pending, pipeline: pipeline, name: name) create(:ci_build, :pending, pipeline: pipeline, name: name)
end end
def requested status
have_requested(:post, hook.url).with do |req|
JSON.parse(req.body)['object_attributes']['status'] == status
end.once
end
let(:build_a) { create_build('a') } let(:build_a) { create_build('a') }
let(:build_b) { create_build('b') } let(:build_b) { create_build('b') }
...@@ -578,7 +584,9 @@ describe Ci::Pipeline, models: true do ...@@ -578,7 +584,9 @@ describe Ci::Pipeline, models: true do
end end
it 'fires 3 hooks' do it 'fires 3 hooks' do
expect(WebMock).to have_requested(:post, hook.url).times(3) %w(pending running success).each do |status|
expect(WebMock).to requested(status)
end
end end
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