Skip to content

Commit

Permalink
feat: update pact with broker for scenario where version does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Mar 24, 2019
1 parent 5ebe808 commit 27b744f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions doc/pacts/markdown/Pact Broker Client - Pact Broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,14 @@ Given **the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6**,
Pact Broker will respond with:
```json
{
"status": 400,
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
"an error message"
]
"summary": {
"reason": "an error message"
}
}
}
```
Expand Down
13 changes: 5 additions & 8 deletions spec/pacts/pact_broker_client-pact_broker.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,17 @@
"query": "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=9.9.9&latestby=cvpv"
},
"response": {
"status": 400,
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
"an error message"
]
"summary": {
"reason": "an error message"
}
},
"matchingRules": {
"$.body.errors": {
"min": 1
},
"$.body.errors[*].*": {
"$.body.summary.reason": {
"match": "type"
}
}
Expand Down
12 changes: 6 additions & 6 deletions spec/service_providers/pact_broker_client_matrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ module PactBroker::Client
query: "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=9.9.9&latestby=cvpv"
).
will_respond_with(
status: 400,
status: 200,
headers: pact_broker_response_headers,
body: {
errors: Pact.each_like("an error message")
summary: {
reason: Pact.like("an error message")
}
}
)
end

let(:selectors) { [{ pacticipant: "Foo", version: "1.2.3" }, { pacticipant: "Bar", version: "9.9.9" }] }

it 'raises an error' do
expect {
pact_broker_client.matrix.get(selectors)
}.to raise_error PactBroker::Client::Error, "an error message"
it 'does not raise an error' do
pact_broker_client.matrix.get(selectors)
end
end

Expand Down

0 comments on commit 27b744f

Please sign in to comment.