diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-03 23:54:44 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-03 23:54:44 +0800 |
commit | 77540619d5ce0e63edec89ea3d406fa457696a0e (patch) | |
tree | f0226ddafe8a0d873b1ae387e399ede94c1db19d | |
parent | 9e06bde269b80b3af01b7cc00bdada1ce2e5e563 (diff) | |
download | gitlab-ce-77540619d5ce0e63edec89ea3d406fa457696a0e.tar.gz |
Test against the status in the payload
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index a8c49daf9bb..b0496a017f4 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -567,6 +567,12 @@ describe Ci::Pipeline, models: true do create(:ci_build, :pending, pipeline: pipeline, name: name) 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_b) { create_build('b') } @@ -578,7 +584,9 @@ describe Ci::Pipeline, models: true do end 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 |