Skip to content

Commit

Permalink
test: test ignored app allows deployable result can-i-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Oct 23, 2024
1 parent 1349bd0 commit 12ee63f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/integration/can_i_merge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ module CLI


it "ignores pacticipant if --ignore flag is provided" do
stub_request(:get, "http://pact-broker/matrix?latest=true&latestby=cvp&mainBranch=true&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=3.4.5&ignore%5B%5D%5Bpacticipant%5D=Foo").
stub_request(:get, "http://pact-broker/matrix?latest=true&latestby=cvp&mainBranch=true&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=5&ignore%5B%5D%5Bpacticipant%5D=Foo").
with(
headers: {
'Accept'=>'application/hal+json',
}).
to_return(status: 200, body: File.read("spec/support/matrix.json"), headers: { "Content-Type" => "application/hal+json" })
stub_const("ARGV", %w[--pacticipant Bar --version 3.4.5 --ignore Foo])
expect($stdout).to receive(:puts).with(/Computer says yes/)
to_return(status: 200, body: File.read("spec/support/matrix_with_ignored_failure.json"), headers: { "Content-Type" => "application/hal+json" })
stub_const("ARGV", %w[--pacticipant Bar --version 5 --ignore Foo])
expect($stdout).to receive(:puts).with(/Computer says yes.*false \[ignored\]/m)
invoke_can_i_merge
end
end
Expand Down
62 changes: 62 additions & 0 deletions spec/support/matrix_with_ignored_failure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"summary": {
"deployable": true,
"ignored": 1,
"unknown": 0
},
"matrix": [
{
"consumer": {
"name": "Baz",
"version": {
"number": "4"
}
},
"provider": {
"name": "Bar",
"version": {
"number": "5"
}
},
"verificationResult": {
"verifiedAt": "2017-10-10T12:49:04+11:00",
"success": true,
"_links": {
"self": {
"href": "http://result"
}
}
},
"pact": {
"createdAt": "2017-10-10T12:49:04+11:00"
}
},
{
"consumer": {
"name": "Foo",
"version": {
"number": "4"
}
},
"provider": {
"name": "Bar",
"version": {
"number": "5"
}
},
"verificationResult": {
"verifiedAt": "2017-10-10T12:49:04+11:00",
"success": false,
"_links": {
"self": {
"href": "http://result"
}
}
},
"ignored": true,
"pact": {
"createdAt": "2017-10-10T12:49:04+11:00"
}
}
]
}

0 comments on commit 12ee63f

Please sign in to comment.